commit
dd66355486
@ -0,0 +1,31 @@
|
||||
package au.com.royalpay.payment.manage.mappers.risk;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2017-12-21 11:45
|
||||
*/
|
||||
@AutoMapper(tablename = "risk_attention_merchants", pkName = "client_id")
|
||||
public interface RiskAttentionMerchantsAMapper {
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject client);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject client);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findById(@Param("id") String id);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findByClientMoniker(@Param("client_moniker") String client_moniker);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
PageList<JSONObject> query(JSONObject params, PageBounds pagination);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2016-06-29.
|
||||
*/
|
||||
@AutoMapper(tablename = "sys_customer_service", pkName = "manager_id")
|
||||
public interface SysCustomerServiceMapper {
|
||||
List<JSONObject> findOnline();
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findByManagerId(@Param("manager_id")String manager_id);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject record);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject record);
|
||||
|
||||
void onoff(@Param("managerId") String managerId, @Param("status") int status);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> findAllWithDetail();
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
package au.com.royalpay.payment.manage.openim;
|
||||
|
||||
import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
|
||||
import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
|
||||
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
|
||||
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/openim")
|
||||
public class OpenimController {
|
||||
|
||||
@Resource
|
||||
private CustomerServiceService customerServiceService;
|
||||
|
||||
@RequestMapping(value = "/check", method = RequestMethod.PUT)
|
||||
@RequireManager
|
||||
public JSONObject sendMsg(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return customerServiceService.checkAndSave(manager);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/findOne", method = RequestMethod.GET)
|
||||
public OpenimUserVO findOne(@RequestParam int clientId, @RequestParam String userName) {
|
||||
return customerServiceService.findOne(clientId, userName);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
public List<JSONObject> query(@RequestParam(required = false) String clientMoniker,@RequestParam(required = false) String userNames){
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("clientMoniker",clientMoniker);
|
||||
params.put("userNames",userNames);
|
||||
return customerServiceService.query(clientMoniker,userNames);
|
||||
}
|
||||
|
||||
@ManagerMapping(value = "/servant/onoff", method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
|
||||
public void listServants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestBody JSONObject param) {
|
||||
customerServiceService.onoff(loginManager,param.getBoolean("onoff"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package au.com.royalpay.payment.manage.openim.beans;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
public class OpenimUser {
|
||||
private String nick;
|
||||
private String icon_url;
|
||||
private String email;
|
||||
private String mobile;
|
||||
private String taobaoid;
|
||||
private String userid;
|
||||
private String passowrd;
|
||||
private String remark;
|
||||
private String extra;
|
||||
private String career;
|
||||
private String vip;
|
||||
private String address;
|
||||
private String name;
|
||||
private Integer age;
|
||||
private String gender;
|
||||
private String wechat;
|
||||
private String qq;
|
||||
private String weibo;
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public String getIcon_url() {
|
||||
return icon_url;
|
||||
}
|
||||
|
||||
public void setIcon_url(String icon_url) {
|
||||
this.icon_url = icon_url;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getTaobaoid() {
|
||||
return taobaoid;
|
||||
}
|
||||
|
||||
public void setTaobaoid(String taobaoid) {
|
||||
this.taobaoid = taobaoid;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getPassowrd() {
|
||||
return passowrd;
|
||||
}
|
||||
|
||||
public void setPassowrd(String passowrd) {
|
||||
this.passowrd = passowrd;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getExtra() {
|
||||
return extra;
|
||||
}
|
||||
|
||||
public void setExtra(String extra) {
|
||||
this.extra = extra;
|
||||
}
|
||||
|
||||
public String getCareer() {
|
||||
return career;
|
||||
}
|
||||
|
||||
public void setCareer(String career) {
|
||||
this.career = career;
|
||||
}
|
||||
|
||||
public String getVip() {
|
||||
return vip;
|
||||
}
|
||||
|
||||
public void setVip(String vip) {
|
||||
this.vip = vip;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getWechat() {
|
||||
return wechat;
|
||||
}
|
||||
|
||||
public void setWechat(String wechat) {
|
||||
this.wechat = wechat;
|
||||
}
|
||||
|
||||
public String getQq() {
|
||||
return qq;
|
||||
}
|
||||
|
||||
public void setQq(String qq) {
|
||||
this.qq = qq;
|
||||
}
|
||||
|
||||
public String getWeibo() {
|
||||
return weibo;
|
||||
}
|
||||
|
||||
public void setWeibo(String weibo) {
|
||||
this.weibo = weibo;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package au.com.royalpay.payment.manage.openim.beans;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/17
|
||||
*/
|
||||
public class OpenimUserVO {
|
||||
private String nick;
|
||||
private String userid;
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package au.com.royalpay.payment.manage.openim.beans;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
public class PushMsgBean {
|
||||
|
||||
private String from_user;
|
||||
private List<String> to_users;
|
||||
private String summary;
|
||||
private String data;
|
||||
|
||||
|
||||
public String getFrom_user() {
|
||||
return from_user;
|
||||
}
|
||||
|
||||
public void setFrom_user(String from_user) {
|
||||
this.from_user = from_user;
|
||||
}
|
||||
|
||||
public List<String> getTo_users() {
|
||||
return to_users;
|
||||
}
|
||||
|
||||
public void setTo_users(List<String> to_users) {
|
||||
this.to_users = to_users;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package au.com.royalpay.payment.manage.openim.core;
|
||||
|
||||
import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
public interface CustomerServiceService {
|
||||
|
||||
JSONObject checkAndSave(JSONObject account);
|
||||
|
||||
OpenimUserVO findOne(int clientId,String userName);
|
||||
|
||||
List<JSONObject> query(String clientMoniker,String userNames);
|
||||
|
||||
void onoff(JSONObject manager,boolean status);
|
||||
|
||||
void addUnreadMsg(JSONObject params);
|
||||
|
||||
void sendUnreadWxMsg();
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package au.com.royalpay.payment.manage.openim.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
public interface OpenimApi {
|
||||
|
||||
void addUser(JSONObject record);
|
||||
|
||||
void updateUser();
|
||||
|
||||
void pushMsh();
|
||||
|
||||
JSONObject getUserInfo(String userId);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package au.com.royalpay.payment.manage.openim.core;
|
||||
|
||||
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.taobao.api.ApiException;
|
||||
import com.taobao.api.DefaultTaobaoClient;
|
||||
import com.taobao.api.TaobaoClient;
|
||||
import com.taobao.api.domain.Userinfos;
|
||||
import com.taobao.api.request.OpenimCustmsgPushRequest;
|
||||
import com.taobao.api.request.OpenimUsersAddRequest;
|
||||
import com.taobao.api.request.OpenimUsersGetRequest;
|
||||
import com.taobao.api.request.OpenimUsersUpdateRequest;
|
||||
import com.taobao.api.response.OpenimCustmsgPushResponse;
|
||||
import com.taobao.api.response.OpenimUsersAddResponse;
|
||||
import com.taobao.api.response.OpenimUsersGetResponse;
|
||||
import com.taobao.api.response.OpenimUsersUpdateResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
@Service
|
||||
public class OpenimClient {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Value("${im.openim.appkey}")
|
||||
private String appkey;
|
||||
@Value("${im.openim.secret}")
|
||||
private String secret;
|
||||
private final String url = "https://eco.taobao.com/router/rest";
|
||||
|
||||
public JSONObject getUser(String userId) {
|
||||
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
|
||||
OpenimUsersGetRequest req = new OpenimUsersGetRequest();
|
||||
// 批量为userid逗号分隔字符串
|
||||
req.setUserids(userId);
|
||||
OpenimUsersGetResponse rsp = null;
|
||||
try {
|
||||
rsp = client.execute(req);
|
||||
} catch (ApiException e) {
|
||||
logger.info("openim get user fail", e);
|
||||
}
|
||||
JSONObject openInfo = JSONObject.parseObject(rsp.getBody());
|
||||
if (openInfo.getJSONObject("openim_users_get_response").getJSONObject("userinfos").size() < 1) {
|
||||
return null;
|
||||
}
|
||||
return openInfo;
|
||||
}
|
||||
|
||||
public void addUser(List<Userinfos> users) {
|
||||
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
|
||||
OpenimUsersAddRequest req = new OpenimUsersAddRequest();
|
||||
req.setUserinfos(users);
|
||||
OpenimUsersAddResponse rsp = null;
|
||||
try {
|
||||
rsp = client.execute(req);
|
||||
} catch (ApiException e) {
|
||||
logger.info("openim add user fail", e);
|
||||
}
|
||||
JSONObject result = JSONObject.parseObject(rsp.getBody());
|
||||
JSONObject failMsg = result.getJSONObject("openim_users_add_response").getJSONObject("fail_msg");
|
||||
if (failMsg.size() > 0) {
|
||||
if ("data exist".equals(failMsg.getJSONArray("string").get(0))) {
|
||||
return;
|
||||
}
|
||||
logger.info("openim add user fail reason:" + failMsg.getJSONArray("string").toJSONString());
|
||||
throw new ServerErrorException("System error");
|
||||
}
|
||||
}
|
||||
|
||||
public void updateUser(List<Userinfos> users) {
|
||||
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
|
||||
OpenimUsersUpdateRequest req = new OpenimUsersUpdateRequest();
|
||||
req.setUserinfos(users);
|
||||
OpenimUsersUpdateResponse rsp = null;
|
||||
try {
|
||||
rsp = client.execute(req);
|
||||
} catch (ApiException e) {
|
||||
logger.info("openim update user fail", e);
|
||||
}
|
||||
JSONObject result = JSONObject.parseObject(rsp.getBody());
|
||||
if (result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").size() > 0) {
|
||||
logger.info("openim update user fail reason:"
|
||||
+ result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString());
|
||||
throw new ServerErrorException("System error");
|
||||
}
|
||||
}
|
||||
|
||||
public void pushMsg(OpenimCustmsgPushRequest.CustMsg msg) {
|
||||
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
|
||||
OpenimCustmsgPushRequest req = new OpenimCustmsgPushRequest();
|
||||
req.setCustmsg(msg);
|
||||
OpenimCustmsgPushResponse rsp = null;
|
||||
try {
|
||||
rsp = client.execute(req);
|
||||
} catch (ApiException e) {
|
||||
logger.info("openim push msg fail", e);
|
||||
}
|
||||
JSONObject result = JSONObject.parseObject(rsp.getBody());
|
||||
if (result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").size() > 0) {
|
||||
logger.info("openim push message fail reason:"
|
||||
+ result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString());
|
||||
throw new ServerErrorException("System error");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String appkey = "24980715";
|
||||
String secret = "60b1ba680a6f27ffc701f10b6d5be00e";
|
||||
String url = "https://eco.taobao.com/router/rest";
|
||||
|
||||
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
|
||||
OpenimUsersAddRequest req = new OpenimUsersAddRequest();
|
||||
List<Userinfos> list2 = new ArrayList<Userinfos>();
|
||||
Userinfos obj3 = new Userinfos();
|
||||
list2.add(obj3);
|
||||
obj3.setNick("king");
|
||||
obj3.setIconUrl("https://ss0.baidu.com/73t1bjeh1BF3odCf/it/u=1948403834,955109320&fm=85&s=0D06E5134AD145F30C8D6D680300303A");
|
||||
obj3.setUserid("kira1");
|
||||
obj3.setPassword("xxxxxx");
|
||||
req.setUserinfos(list2);
|
||||
OpenimUsersAddResponse rsp = null;
|
||||
try {
|
||||
rsp = client.execute(req);
|
||||
} catch (ApiException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(rsp.getBody());
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
package au.com.royalpay.payment.manage.openim.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.SysCustomerServiceMapper;
|
||||
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
||||
import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
|
||||
import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
|
||||
import au.com.royalpay.payment.manage.openim.core.OpenimApi;
|
||||
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
|
||||
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
|
||||
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.BoundListOperations;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
@Service
|
||||
public class CustomerServiceServiceImpl implements CustomerServiceService {
|
||||
|
||||
@Resource
|
||||
private OpenimApi openimApi;
|
||||
@Resource
|
||||
private ClientManager clientManager;
|
||||
@Resource
|
||||
private ClientAccountMapper clientAccountMapper;
|
||||
@Resource
|
||||
private ManagerMapper managerMapper;
|
||||
@Resource
|
||||
private SysCustomerServiceMapper sysCustomerServiceMapper;
|
||||
@Resource
|
||||
private MpWechatApiProvider mpWechatApiProvider;
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
private final String REDIS_UNREADMSG_PREFIX = "REDIS_UNREADMSG_PREFIX";
|
||||
private final String REDIS_UNREADMSG_SEND_PREFIX = "REDIS_UNREADMSG_SEND_PREFIX";
|
||||
|
||||
@Value("${im.openim.appkey}")
|
||||
private String appkey;
|
||||
|
||||
@Override
|
||||
public JSONObject checkAndSave(JSONObject account) {
|
||||
JSONObject client = null;
|
||||
boolean isPartner = true;
|
||||
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
|
||||
client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
||||
if (client == null) {
|
||||
throw new BadRequestException("Merchant Not Found");
|
||||
}
|
||||
account = clientAccountMapper.findById(account.getString("account_id"));
|
||||
isPartner = true;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
|
||||
account = managerMapper.findDetail(account.getString("manager_id"));
|
||||
isPartner = false;
|
||||
}
|
||||
String uid = account.getString("username") + (isPartner ? "_" + client.getString("client_moniker") : "");
|
||||
JSONObject saveRecord = new JSONObject();
|
||||
saveRecord.put("nick", account.getString("display_name"));
|
||||
saveRecord.put("password", DigestUtils.md5Hex("uid"));
|
||||
if (isPartner) {
|
||||
saveRecord.put("user_id", uid);
|
||||
saveRecord.put("servants", sysCustomerServiceMapper.findOnline());
|
||||
} else {
|
||||
saveRecord.put("user_id", uid);
|
||||
}
|
||||
openimApi.addUser(saveRecord);
|
||||
saveRecord.put("appkey", appkey);
|
||||
return saveRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpenimUserVO findOne(int clientId, String userName) {
|
||||
JSONObject client = clientManager.getClientInfo(clientId);
|
||||
if (client == null) {
|
||||
throw new BadRequestException("Merchant Not Found");
|
||||
}
|
||||
JSONObject account = clientAccountMapper.findByUsername(userName);
|
||||
if (account == null) {
|
||||
throw new BadRequestException("Account Not Found");
|
||||
}
|
||||
if (account.getIntValue("client_id") != clientId) {
|
||||
throw new ForbiddenException("No Rights");
|
||||
}
|
||||
OpenimUserVO result = new OpenimUserVO();
|
||||
result.setNick(account.getString("display_name"));
|
||||
result.setUserid(account.getString("username") + "_" + client.getString("client_moniker"));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> query(String clientMoniker, String userNames) {
|
||||
JSONObject queryParams = new JSONObject();
|
||||
if (StringUtils.isNotEmpty(clientMoniker)) {
|
||||
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
||||
if (client == null) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
queryParams.put("clientId", client.getIntValue("client_id"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(userNames)) {
|
||||
queryParams.put("userNames", Arrays.asList(userNames.split(",")));
|
||||
}
|
||||
if (queryParams.size() < 1) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JSONObject> accounts = clientAccountMapper.query(queryParams);
|
||||
List<JSONObject> result = new ArrayList<>(accounts.size());
|
||||
accounts.forEach(p -> {
|
||||
JSONObject openimUser = new JSONObject();
|
||||
openimUser.put("userid", p.getString("username") + "_" + p.getString("client_moniker"));
|
||||
openimUser.put("nick", p.getString("username") + "_" + p.getString("client_moniker"));
|
||||
openimUser.put("headimg", p.getString("wechat_headimg"));
|
||||
result.add(openimUser);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoff(JSONObject manager, boolean onoff) {
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("manager_id", manager.getString("manager_id"));
|
||||
record.put("onoff", onoff);
|
||||
udpateOrSave(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUnreadMsg(JSONObject params) {
|
||||
String uid = params.getString("uid");
|
||||
String tuid = params.getString("tuid");
|
||||
if (StringUtils.isEmpty(uid) || StringUtils.isEmpty(tuid)) {
|
||||
return;
|
||||
}
|
||||
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + tuid);
|
||||
for (int i = 0; i < ops.size(); i++) {
|
||||
String jStr = ops.index(i);
|
||||
if (jStr.contains(uid)) {
|
||||
JSONObject record = JSONObject.parseObject(jStr);
|
||||
record.put("unreadMsg", record.getIntValue("unreadMsg") + 1);
|
||||
ops.set(i, record.toJSONString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
params.put("unreadMsg", 1);
|
||||
ops.rightPush(params.toJSONString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUnreadWxMsg() {
|
||||
List<JSONObject> servants = sysCustomerServiceMapper.findAllWithDetail();
|
||||
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
|
||||
servants.parallelStream().forEach(p -> {
|
||||
p.getString("user_id");
|
||||
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + p.getString("user_id"));
|
||||
if (ops.size() < 1) {
|
||||
return;
|
||||
}
|
||||
int clients = 0;
|
||||
int unreadMsg = 0;
|
||||
for (int i = 0; i < ops.size(); i++) {
|
||||
clients++;
|
||||
unreadMsg += JSONObject.parseObject(ops.index(i)).getIntValue("unreadMsg");
|
||||
}
|
||||
TemplateMessage msg = initUnreadMsg(unreadMsg, clients, p.getString("wx_openid"), paymentApi.getTemplateId("commission"));
|
||||
paymentApi.sendTemplateMessage(msg);
|
||||
stringRedisTemplate.delete("REDIS_UNREADMSG_PREFIX" + p.getString("user_id"));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private TemplateMessage initUnreadMsg(int unreadMsg, int clients, String openId, String templateId) {
|
||||
TemplateMessage msg = new TemplateMessage(openId, templateId, null);
|
||||
msg.put("first", "你好,你有" + unreadMsg + "个未读消息", "#000000");
|
||||
msg.put("keyword1", "商户", "#000000");
|
||||
msg.put("keyword2", "问题咨询", "#000000");
|
||||
msg.put("keyword3", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000");
|
||||
msg.put("keyword4", "你有" + clients + "个商户咨询待处理", "#0000ff");
|
||||
msg.put("remark", "", "#000000");
|
||||
return msg;
|
||||
}
|
||||
|
||||
private void udpateOrSave(JSONObject servant) {
|
||||
JSONObject record = sysCustomerServiceMapper.findByManagerId(servant.getString("manager_id"));
|
||||
if (record == null) {
|
||||
JSONObject manager = managerMapper.findDetail(servant.getString("manager_id"));
|
||||
servant.put("manager_id", manager.getString("manager_id"));
|
||||
servant.put("user_id", manager.getString("username"));
|
||||
sysCustomerServiceMapper.save(servant);
|
||||
} else {
|
||||
sysCustomerServiceMapper.update(servant);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package au.com.royalpay.payment.manage.openim.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.manage.openim.core.OpenimApi;
|
||||
import au.com.royalpay.payment.manage.openim.core.OpenimClient;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.taobao.api.domain.Userinfos;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
@Service
|
||||
public class OpenimApiImpl implements OpenimApi {
|
||||
|
||||
@Resource
|
||||
private OpenimClient openimClient;
|
||||
|
||||
@Override
|
||||
public void addUser(JSONObject user) {
|
||||
JSONObject opemInfo = openimClient.getUser(user.getString("user_id"));
|
||||
if(opemInfo!=null){
|
||||
return;
|
||||
}
|
||||
List<Userinfos> saveList = new ArrayList<>();
|
||||
Userinfos record = new Userinfos();
|
||||
record.setUserid(user.getString("user_id"));
|
||||
record.setNick(user.getString("nick"));
|
||||
record.setPassword(user.getString("password"));
|
||||
saveList.add(record);
|
||||
openimClient.addUser(saveList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushMsh() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getUserInfo(String userId) {
|
||||
return openimClient.getUser(userId);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package au.com.royalpay.payment.manage.risk.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* Created by yuan on 2018/7/13.
|
||||
*/
|
||||
public class QueryAttentionMerchants {
|
||||
private String client_moniker;
|
||||
|
||||
private int page = 1;
|
||||
private int limit = 10;
|
||||
|
||||
|
||||
|
||||
public JSONObject toParams() {
|
||||
JSONObject params = new JSONObject();
|
||||
if(StringUtils.isNotEmpty(client_moniker)){
|
||||
params.put("client_moniker", this.client_moniker);
|
||||
}
|
||||
params.put("is_valid", 1);
|
||||
return params;
|
||||
}
|
||||
|
||||
public String getClient_moniker() {
|
||||
return client_moniker;
|
||||
}
|
||||
|
||||
public void setClient_moniker(String client_moniker) {
|
||||
this.client_moniker = client_moniker;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package au.com.royalpay.payment.manage.signin.beans;
|
||||
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* Created by yuan on 2018/7/13.
|
||||
*/
|
||||
public class QueryManagerBean {
|
||||
private String org_id;
|
||||
private String org_id2;
|
||||
private String role;
|
||||
private String username;
|
||||
|
||||
private int page = 1;
|
||||
private int limit = 10;
|
||||
|
||||
public JSONObject toJson(){
|
||||
JSONObject params = new JSONObject();
|
||||
if (StringUtils.isNotEmpty(org_id)){
|
||||
params.put("org_id",org_id);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(org_id2)){
|
||||
params.put("org_id2",org_id2);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(role)){
|
||||
int mask = 0;
|
||||
if(role.equals("1")){
|
||||
mask = ManagerRole.ADMIN.getMask();
|
||||
}
|
||||
if(role.equals("10")){
|
||||
mask = ManagerRole.OPERATOR.getMask();
|
||||
}
|
||||
if(role.equals("100")){
|
||||
mask = ManagerRole.BD_USER.getMask();
|
||||
}
|
||||
if(role.equals("1000")){
|
||||
mask = ManagerRole.FINANCIAL_STAFF.getMask();
|
||||
}
|
||||
if(role.equals("10000")){
|
||||
mask = ManagerRole.SERVANT.getMask();
|
||||
}
|
||||
if(role.equals("100000")){
|
||||
mask = ManagerRole.ACCOUNT_MANAGER.getMask();
|
||||
}
|
||||
if(role.equals("1000000")){
|
||||
mask = ManagerRole.DIRECTOR.getMask();
|
||||
}
|
||||
if(role.equals("10000000")){
|
||||
mask = ManagerRole.SITE_MANAGER.getMask();
|
||||
}
|
||||
if(role.equals("100000000")){
|
||||
mask = ManagerRole.DEVELOPER.getMask();
|
||||
}
|
||||
if(role.equals("1000000000")){
|
||||
mask = ManagerRole.BD_LEADER.getMask();
|
||||
}
|
||||
if(role.equals("10000000000")){
|
||||
mask = ManagerRole.RISK_MANAGER.getMask();
|
||||
}
|
||||
if(role.equals("100000000000")){
|
||||
mask = ManagerRole.GUEST.getMask();
|
||||
}
|
||||
if(role.equals("1000000000000")){
|
||||
mask = ManagerRole.ORG_MANAGER.getMask();
|
||||
}
|
||||
if(mask != 0){
|
||||
params.put("mask",mask);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(username)){
|
||||
params.put("username",username);
|
||||
}
|
||||
params.put("page",page);
|
||||
params.put("limit",10);
|
||||
return params;
|
||||
}
|
||||
|
||||
public String getOrg_id() {
|
||||
return org_id;
|
||||
}
|
||||
|
||||
public void setOrg_id(String org_id) {
|
||||
this.org_id = org_id;
|
||||
}
|
||||
|
||||
public String getOrg_id2() {
|
||||
return org_id2;
|
||||
}
|
||||
|
||||
public void setOrg_id2(String org_id2) {
|
||||
this.org_id2 = org_id2;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package au.com.royalpay.payment.manage.task;
|
||||
|
||||
import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created by wangning on 2018/1/2.
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
|
||||
public class SendUnreadMsgWechatTask {
|
||||
@Resource
|
||||
private CustomerServiceService customerServiceService;
|
||||
|
||||
// @Scheduled(cron = "0 0/10 * * * ?")
|
||||
public void ofeiOrderCheck() {
|
||||
customerServiceService.sendUnreadWxMsg();
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper">
|
||||
<select id="query" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT a.*,c.client_moniker client_moniker FROM sys_accounts a left join sys_clients c on c.client_id = a.client_id
|
||||
<where>
|
||||
<if test="clientId!=null">
|
||||
and a.client_id = #{clientId}
|
||||
</if>
|
||||
<if test="userNames!=null">
|
||||
and a.username in (
|
||||
<foreach collection="userNames" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.SysCustomerServiceMapper">
|
||||
<select id="findOnline" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select user_id from sys_customer_service
|
||||
where `onoff` = 1
|
||||
</select>
|
||||
|
||||
<update id="onoff">
|
||||
udpate sys_customer_servie
|
||||
set status = #{status}
|
||||
where manager_id = #{managerId}
|
||||
</update>
|
||||
<select id="findAllWithDetail" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select s.user_id,s.onoff,m.* from
|
||||
sys_customer_service s left join sys_managers m
|
||||
on s.manager_id = m.manager_id
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.3.3/scripts/kit.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" data-th-inline="javascript">
|
||||
window.uid = /*[[*{uid}]]*/null;
|
||||
window.credential = /*[[*{password}]]*/null;
|
||||
window.onload = function(){
|
||||
WKIT.init({
|
||||
container: document.getElementById('J_demo'),
|
||||
width: 700,
|
||||
height: 500,
|
||||
uid: window.uid,
|
||||
appkey: 24962653,
|
||||
credential: window.credential,
|
||||
touid: 'imuser1234',
|
||||
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
|
||||
pluginUrl: 'http://www.taobao.com/market/seller/openim/plugindemo.php'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
</html>
|
@ -0,0 +1,129 @@
|
||||
<html>
|
||||
<!--[if lt IE 9]>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
|
||||
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
|
||||
<![endif]-->
|
||||
<!-- 自动适配移动端与pc端 -->
|
||||
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.4.0/scripts/kit.js"
|
||||
charset="utf-8"></script>
|
||||
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
window.uid = getQueryString('uid');
|
||||
window.touid = getQueryString('uid');
|
||||
window.password = getQueryString('p');
|
||||
window.appKey = getQueryString('key');
|
||||
WKIT.init({
|
||||
container: document.getElementById('J_demo'),
|
||||
width: 700,
|
||||
height: 500,
|
||||
uid: window.uid,
|
||||
appkey: window.appKey,
|
||||
credential: window.password,
|
||||
touid: window.touid,
|
||||
pluginUrl: '/service_contact_list.html?uid='
|
||||
+ window.uid,
|
||||
onLoginSuccess: function (data) {
|
||||
initLayout();
|
||||
WKIT.Conn.sdk.Event.on('MSG_RECEIVED', function (data) {
|
||||
updateContractList(data.data);
|
||||
});
|
||||
initUnreadMsgAndContact();
|
||||
WKIT.Conn.sdk.Base.startListenAllMsg();
|
||||
window.sdk = document.getElementById("J_wkitPluginFrame").contentWindow;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function switchTouid(touid) {
|
||||
window.uid = touid;
|
||||
WKIT.switchTouid({
|
||||
touid: touid,
|
||||
logo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
|
||||
Avatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
|
||||
toAvatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg'
|
||||
});
|
||||
WKIT.Conn.sdk.Chat.setReadState({
|
||||
touid: touid,
|
||||
timestamp: Math.floor((+new Date()) / 1000),
|
||||
success: function (data) {
|
||||
},
|
||||
error: function (error) {
|
||||
console.log('set read state fail', error);
|
||||
}
|
||||
});
|
||||
window.sdk.unreadMap[touid].msgCount = 0;
|
||||
window.sdk.showContactList(window.sdk.unreadMap);
|
||||
}
|
||||
|
||||
function initUnreadMsgAndContact() {
|
||||
WKIT.Conn.sdk.Base.getRecentContact({
|
||||
count: 40,
|
||||
success: function (data) {
|
||||
var cnts = data.data.cnts;
|
||||
for (var i = cnts.length - 1; i >= 0; i--) {
|
||||
var unreadmapEle = {msgCount: 0};
|
||||
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(
|
||||
cnts[i].from)] = unreadmapEle;
|
||||
}
|
||||
getUnreadMsgCount();
|
||||
},
|
||||
error: function (error) {
|
||||
console.log('get contact msg count fail',
|
||||
error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getUnreadMsgCount() {
|
||||
WKIT.Conn.sdk.Base.getUnreadMsgCount({
|
||||
count: 40,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var unreads = data.data;
|
||||
var uids = "";
|
||||
for (var i = unreads.length - 1; i >= 0; i--) {
|
||||
if(window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)]){
|
||||
|
||||
}
|
||||
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)].msgCount =
|
||||
unreads[i].msgCount;
|
||||
var nick = WKIT.Conn.sdk.Base.getNick(unreads[i].contact)
|
||||
uids += nick.substr(0,nick.length-6) + ",";
|
||||
}
|
||||
window.sdk.loadContactList(uids);
|
||||
},
|
||||
error: function (error) {
|
||||
console.log('get recent contact fail', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateContractList(data) {
|
||||
var msg = data.msgs[0];
|
||||
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
|
||||
if (window.sdk.unreadMap[msg_uid]) {
|
||||
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
|
||||
} else {
|
||||
var unreadMapEle = {msgCount: 1}
|
||||
window.sdk.unreadMap[msg_uid] = unreadMapEle;
|
||||
}
|
||||
window.sdk.loadContactList(msg_uid.substr(0,msg_uid-6));
|
||||
}
|
||||
|
||||
function initLayout() {
|
||||
$("#J_wkitUserInfo").hide();
|
||||
$("#J_wkitPluginFrameWrap").height("100%");
|
||||
$("#J_wkitPluginFrameWrap").css("margin", "0 0 0 0");
|
||||
}
|
||||
|
||||
function getQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return unescape(r[2]); return null;
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
@ -0,0 +1,202 @@
|
||||
<html>
|
||||
<!--[if lt IE 9]>
|
||||
<meta charset="utf-8"/>
|
||||
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
|
||||
<![endif]-->
|
||||
<!-- 自动适配移动端与pc端 -->
|
||||
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"
|
||||
charset="UTF-8"></script>
|
||||
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
|
||||
|
||||
<style>
|
||||
li {
|
||||
float: left;
|
||||
list-style-type: none;
|
||||
transition: background-color .1s;
|
||||
margin-bottom: 13px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.search-div {
|
||||
height: 3%;
|
||||
}
|
||||
|
||||
.search-div input {
|
||||
background: #D8D8D8;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.hover {
|
||||
color: black;
|
||||
background-color: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.active {
|
||||
color: red;
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.headimg {
|
||||
float: left;
|
||||
border-radius: 50%;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border: 1px solid #000;
|
||||
border-radius: 50%;
|
||||
background-position: center;
|
||||
background-attachment: inherit;
|
||||
}
|
||||
|
||||
.headimg-img {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
margin-top: 8px;
|
||||
padding-left: 27px;
|
||||
}
|
||||
|
||||
.notice {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #f00;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
right: -16px;
|
||||
top: -7px;
|
||||
}
|
||||
|
||||
.frm_search {
|
||||
width: 133px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
background-color: #D8D8D8;
|
||||
color: #fff;
|
||||
padding-left: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.search_bar {
|
||||
position: relative;
|
||||
width: 137px;
|
||||
margin: 0 auto 6px;
|
||||
}
|
||||
|
||||
.web_wechat_search {
|
||||
background: url(/static/images/search.png) no-repeat;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 25px;
|
||||
height: 30px;
|
||||
position: absolute;
|
||||
line-height: 1.6;
|
||||
background-size: 16px;
|
||||
background-position: 5px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var unreadMap = {};
|
||||
function searchContact() {
|
||||
var uid = $('#searchText').val();
|
||||
var searchContactList = {};
|
||||
for (var key in unreadMap) {
|
||||
if (key.search(uid) > -1) {
|
||||
searchContactList[key] = unreadMap[key];
|
||||
}
|
||||
}
|
||||
var param = {clientMoniker: uid};
|
||||
$.ajax({
|
||||
url: '/sys/openim/list',
|
||||
method: 'GET',
|
||||
data: param,
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
success: function (resp) {
|
||||
for (var i = 0; i <= resp.length - 1; i++) {
|
||||
resp[i].msgCount = 0;
|
||||
searchContactList[resp[i].nick] = resp[i];
|
||||
unreadMap[resp[i].nick] = resp[i];
|
||||
}
|
||||
showContactList(searchContactList);
|
||||
},
|
||||
error: function () {
|
||||
showContactList(searchContactList);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadContactList(uids) {
|
||||
var param = {userNames: uids};
|
||||
$.ajax({
|
||||
url: '/sys/openim/list',
|
||||
method: 'GET',
|
||||
data: param,
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
success: function (resp) {
|
||||
for (var i = 0; i <= resp.length - 1; i++) {
|
||||
unreadMap[resp[i].nick].headimg = resp[i].headimg;
|
||||
}
|
||||
showContactList(unreadMap);
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
function showContactList(map) {
|
||||
var contact_list = '';
|
||||
for (var key in map) {
|
||||
var css = 'hover';
|
||||
if (key == parent.window.uid) {
|
||||
css = 'active';
|
||||
}
|
||||
var headImUrl = '';
|
||||
if (map[key].headimg) {
|
||||
headImUrl = map[key].headimg;
|
||||
} else {
|
||||
headImUrl = "/static/images/act/encourage_money/default_headimg.png";
|
||||
}
|
||||
contact_list +=
|
||||
"<li " + " class=\"" + css + "\" onclick=switchToUser('" + key
|
||||
+ "')>"
|
||||
+ "<div class=\"headimg\" style='background-image:url(" + headImUrl
|
||||
+ "')>"
|
||||
+ "<div class=\"notice\">" + map[key].msgCount + "</div>"
|
||||
+ "</div>"
|
||||
+ "<div class=\"avatar\">" + key + "</div>"
|
||||
+ "</li>"
|
||||
}
|
||||
$("#contact_list").html(contact_list);
|
||||
}
|
||||
|
||||
function switchToUser(touid) {
|
||||
parent.switchTouid(touid);
|
||||
}
|
||||
|
||||
</script>
|
||||
<body>
|
||||
<div class="search_bar">
|
||||
<i class="web_wechat_search"></i>
|
||||
<input id="searchText" class="frm_search" type="text" onchange="searchContact()">
|
||||
</div>
|
||||
<div class="list">
|
||||
<ul id="contact_list">
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<!--[if lt IE 9]>
|
||||
<meta charset="utf-8" />
|
||||
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
|
||||
<![endif]-->
|
||||
<!-- 自动适配移动端与pc端 -->
|
||||
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.3.3/scripts/kit.js"
|
||||
charset="utf-8"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
WKIT.init({
|
||||
container: document.getElementById('J_demo'),
|
||||
width: 700,
|
||||
height: 500,
|
||||
uid: 'kira1',
|
||||
appkey: 24980715,
|
||||
credential: 'xxxxxx',
|
||||
touid: 'dalong',
|
||||
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</html>
|
@ -0,0 +1,52 @@
|
||||
<section class="content-header">
|
||||
<h1>Mail Not Subscribe</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<a ui-sref="^"><i class="fa fa-cog"></i> System Config</a>
|
||||
</li>
|
||||
<li>Mail Not Subscribe</li>
|
||||
</ol>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="box-solid">
|
||||
<!--<div class="box box-warning">-->
|
||||
<!--<div class="box-header">-->
|
||||
<!--<div class="form-inline">-->
|
||||
<!--<div class="form-group">-->
|
||||
<!--<input class="form-control" placeholder="Client Moniker" ng-model="params.client_moniker">-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group">-->
|
||||
<!--<input class="form-control" placeholder="Mail Address" ng-model="params.address">-->
|
||||
<!--</div>-->
|
||||
<!--<button class="btn btn-success" ng-click="loadUnSubs(1)"><i-->
|
||||
<!--class="fa fa-search"></i> Search</button>-->
|
||||
<!--<button class="btn btn-success pull-right" ng-click="addUnSub()" ng-click="addUnSubs()">Add</button>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="box">
|
||||
<div class="box-body no-padding table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Display Name</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="servant in servants">
|
||||
<td ng-bind="servant.display_name"></td>
|
||||
<td>
|
||||
<input type="checkbox" ng-click="onoff(servant)" ng-model="servant.onoff">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 431 B |
@ -0,0 +1,84 @@
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>Risky Merchants</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><i class="fa fa-gift"></i> Risk</li>
|
||||
<li class="active">Risk Merchants</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="partner-code-search">Partner Code</label>
|
||||
<input type="text" class="form-control" id="partner-code-search"
|
||||
ng-enter="loadAttentionMerchants(1)"
|
||||
ng-model="params.client_moniker">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary" type="button" ng-click="loadAttentionMerchants(1)"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
|
||||
<div class="form-group pull-right">
|
||||
<button ng-hide="ctrl.addAttention" class="btn btn-info" type="button" ng-click="ctrl.addAttention = true"><i class="fa fa-plus"></i>Add</button>
|
||||
<div class="input-group" ng-if="ctrl.addAttention">
|
||||
<input type="text" class="form-control" ng-model="client_moniker"
|
||||
title="Add Attention" placeholder="client Moniker">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-success" ng-click="addAttentionMerchants(client_moniker)">
|
||||
<i class="fa fa-check"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-danger" ng-click="ctrl.addAttention=false">
|
||||
<i class="fa fa-remove"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">Clients</div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client Moniker</th>
|
||||
<th>Create Time</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in attentions">
|
||||
<td>{{client.client_moniker}}</td>
|
||||
<td>{{client.create_time}}</td>
|
||||
<td>
|
||||
<a role="button" class="text-bold text-danger"
|
||||
ng-click="disableAttention(client.client_moniker)">Disable</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="attentions.length"
|
||||
class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadAttentionMerchants()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue