|
@@ -10,6 +10,7 @@ use app\weixin\model\AccountLog;
|
|
|
use app\weixin\model\UserBalanceLog;
|
|
use app\weixin\model\UserBalanceLog;
|
|
|
use app\weixin\model\Member;
|
|
use app\weixin\model\Member;
|
|
|
use app\weixin\model\Storage;
|
|
use app\weixin\model\Storage;
|
|
|
|
|
+use app\weixin\model\UserContactLog;
|
|
|
use app\weixin\model\UserLog;
|
|
use app\weixin\model\UserLog;
|
|
|
use app\weixin\model\UserProfile;
|
|
use app\weixin\model\UserProfile;
|
|
|
use app\weixin\model\Wechat;
|
|
use app\weixin\model\Wechat;
|
|
@@ -106,6 +107,61 @@ class MarketController extends MarketBaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 获取主页信息
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getHomeInfo()
|
|
|
|
|
+ {
|
|
|
|
|
+ $id = input('id', 0);
|
|
|
|
|
+ $cid = input('cid', 0);
|
|
|
|
|
+ $type = input('type', 1);
|
|
|
|
|
+ // 基础信息
|
|
|
|
|
+ $userId = $id ? $id : $this->userId;
|
|
|
|
|
+ $myInfo = Member::getHomeInfo($userId, '', $type);
|
|
|
|
|
+ if($myInfo){
|
|
|
|
|
+ $myInfo['wechat_code'] = isset($myInfo['wechat_account'])? $myInfo['wechat_account'] : '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $cUserInfo = [];
|
|
|
|
|
+ $cInfo = [];
|
|
|
|
|
+ if ($cid <= 0 && $id) {
|
|
|
|
|
+ $cid = UserContactLog::where(['user_id' => $this->userId, 'contact_uid' => $id])
|
|
|
|
|
+ ->where('status', 'in', [1, 2, 3])
|
|
|
|
|
+ ->value('id');
|
|
|
|
|
+ if ($cid <= 0) {
|
|
|
|
|
+ $cid = UserContactLog::where(['contact_uid' => $this->userId, 'user_id' => $id])
|
|
|
|
|
+ ->where('status', 'in', [1, 2, 3])
|
|
|
|
|
+ ->value('id');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($cid > 0) {
|
|
|
|
|
+ // 认识记录
|
|
|
|
|
+ $cInfo = UserContactLog::where(['id' => $cid])->where('status', 'in', [1, 2, 3])->field('id,user_id,contact_uid,is_read,status')->find();
|
|
|
|
|
+ $cUid = isset($cInfo['contact_uid']) ? intval($cInfo['contact_uid']) : 0;
|
|
|
|
|
+ $status = isset($cInfo['status']) ? intval($cInfo['status']) : 0;
|
|
|
|
|
+ if ($cUid) {
|
|
|
|
|
+
|
|
|
|
|
+ // 被申请方查看,更新申请微信阅读状态
|
|
|
|
|
+ if($cUid == $this->userId){
|
|
|
|
|
+ UserContactLog::where(['id' => $cid])->update(['is_read'=> 1]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 想认识的人的信息
|
|
|
|
|
+ $field = 'm.id,m.user_nickname,m.avatar,m.real_name,up.wechat_code,up.qq';
|
|
|
|
|
+ $cUserInfo = Member::getHomeInfo($cUid, $field, 2);
|
|
|
|
|
+
|
|
|
|
|
+ // 未确认认识的不展示联系方式
|
|
|
|
|
+ if ($status != 2 && $cUserInfo) {
|
|
|
|
|
+ $cUserInfo['wechat_code'] = '';
|
|
|
|
|
+ $cUserInfo['qq'] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ PRedis::set('test:' . $userId, ['homeInfo' => $myInfo, 'cUserInfo' => $cUserInfo, 'cInfo' => $cInfo], 600);
|
|
|
|
|
+ showJson(1005, 1008, ['homeInfo' => $myInfo, 'cUserInfo' => $cUserInfo, 'cInfo' => $cInfo]);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 注册
|
|
* 注册
|
|
|
*/
|
|
*/
|
|
|
public function register(){
|
|
public function register(){
|
|
@@ -178,6 +234,7 @@ class MarketController extends MarketBaseController
|
|
|
'user_pass' => $userPass,
|
|
'user_pass' => $userPass,
|
|
|
'pay_password' => $userPass,
|
|
'pay_password' => $userPass,
|
|
|
'last_login_ip' => get_client_ip(),
|
|
'last_login_ip' => get_client_ip(),
|
|
|
|
|
+ 'wechat_account' => isset($params['wechat_code']) ? trim($params['wechat_code']) : '',
|
|
|
'is_follow' => isset($wxInfo['subscribe']) ? intval($wxInfo['subscribe']) : 0,
|
|
'is_follow' => isset($wxInfo['subscribe']) ? intval($wxInfo['subscribe']) : 0,
|
|
|
'sex' => isset($wxInfo['sex']) ? intval($wxInfo['sex']) : 0,
|
|
'sex' => isset($wxInfo['sex']) ? intval($wxInfo['sex']) : 0,
|
|
|
'last_login_time' => time(),
|
|
'last_login_time' => time(),
|
|
@@ -194,6 +251,7 @@ class MarketController extends MarketBaseController
|
|
|
if (!$agentId) {
|
|
if (!$agentId) {
|
|
|
$res = $agentId = Member::insertGetId($memberData);
|
|
$res = $agentId = Member::insertGetId($memberData);
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ $where['id'] = $agentId;
|
|
|
$res = Member::where($where)->update($memberData);
|
|
$res = Member::where($where)->update($memberData);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -209,7 +267,6 @@ class MarketController extends MarketBaseController
|
|
|
'province' => isset($nowAddress[0]) ? $nowAddress[0] : '',
|
|
'province' => isset($nowAddress[0]) ? $nowAddress[0] : '',
|
|
|
'city' => isset($nowAddress[1]) ? $nowAddress[1] : '',
|
|
'city' => isset($nowAddress[1]) ? $nowAddress[1] : '',
|
|
|
'district' => isset($nowAddress[2]) ? $nowAddress[2] : '',
|
|
'district' => isset($nowAddress[2]) ? $nowAddress[2] : '',
|
|
|
- 'wechat_code' => isset($params['wechat_code']) ? trim($params['wechat_code']) : '',
|
|
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
if (UserProfile::checkProfile($agentId)) {
|
|
if (UserProfile::checkProfile($agentId)) {
|
|
@@ -234,7 +291,7 @@ class MarketController extends MarketBaseController
|
|
|
session('userInfo', null);
|
|
session('userInfo', null);
|
|
|
|
|
|
|
|
showJson(1005, 2043);
|
|
showJson(1005, 2043);
|
|
|
- } catch (\Exception $exception) {
|
|
|
|
|
|
|
+ } catch (\Exception $exception) {
|
|
|
PRedis::set('members:marketReg:error:' . $agentId, $exception->getMessage(), 6 * 3600);
|
|
PRedis::set('members:marketReg:error:' . $agentId, $exception->getMessage(), 6 * 3600);
|
|
|
showJson(1004, 2136);
|
|
showJson(1004, 2136);
|
|
|
}
|
|
}
|
|
@@ -275,7 +332,6 @@ class MarketController extends MarketBaseController
|
|
|
'province' => isset($nowAddress[0]) ? $nowAddress[0] : '',
|
|
'province' => isset($nowAddress[0]) ? $nowAddress[0] : '',
|
|
|
'city' => isset($nowAddress[1]) ? $nowAddress[1] : '',
|
|
'city' => isset($nowAddress[1]) ? $nowAddress[1] : '',
|
|
|
'district' => isset($nowAddress[2]) ? $nowAddress[2] : '',
|
|
'district' => isset($nowAddress[2]) ? $nowAddress[2] : '',
|
|
|
- 'wechat_code' => isset($params['wechat_code']) ? trim($params['wechat_code']) : '',
|
|
|
|
|
'qq' => isset($params['qq']) ? trim($params['qq']) : '',
|
|
'qq' => isset($params['qq']) ? trim($params['qq']) : '',
|
|
|
];
|
|
];
|
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
@@ -295,6 +351,7 @@ class MarketController extends MarketBaseController
|
|
|
$memberData = [
|
|
$memberData = [
|
|
|
'user_nickname' => isset($params['nickname']) ? trim($params['nickname']) : '',
|
|
'user_nickname' => isset($params['nickname']) ? trim($params['nickname']) : '',
|
|
|
'birthday' => $birthday,
|
|
'birthday' => $birthday,
|
|
|
|
|
+ 'wechat_account' => isset($params['wechat_code']) ? trim($params['wechat_code']) : '',
|
|
|
'sex' => isset($params['sex']) ? intval($params['sex']) : 0,
|
|
'sex' => isset($params['sex']) ? intval($params['sex']) : 0,
|
|
|
];
|
|
];
|
|
|
if ($newMobile && $mobile != $newMobile) {
|
|
if ($newMobile && $mobile != $newMobile) {
|