|
|
@@ -123,7 +123,7 @@ class MemberController extends BaseController
|
|
|
|
|
|
// 是否已经认证
|
|
|
if ($type == 2 || $type == 4 || $type == 1) {
|
|
|
- $field = 'idcard_check,education_check,position_check';
|
|
|
+ $field = 'idcard_check,education_check,position_check,wechat_code';
|
|
|
$authData = UserProfile::where(['userid' => $userId])
|
|
|
->field($field)
|
|
|
->find();
|
|
|
@@ -131,6 +131,7 @@ class MemberController extends BaseController
|
|
|
$memberInfo['idcard_check'] = isset($authData['idcard_check']) ? intval($authData['idcard_check']) : 0;
|
|
|
$memberInfo['education_check'] = isset($authData['education_check']) ? intval($authData['education_check']) : 0;
|
|
|
$memberInfo['position_check'] = isset($authData['position_check']) ? intval($authData['position_check']) : 0;
|
|
|
+ $memberInfo['wechat_code'] = isset($authData['wechat_code']) ? $authData['wechat_code'] : '';
|
|
|
if ($memberInfo['idcard_check'] == 2 && $memberInfo['education_check'] == 2 && $memberInfo['position_check'] == 2) {
|
|
|
$memberInfo['is_auth'] = 1;
|
|
|
}
|
|
|
@@ -881,6 +882,36 @@ class MemberController extends BaseController
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 设置微信号
|
|
|
+ */
|
|
|
+ public function setWechat(){
|
|
|
+ $params = input();
|
|
|
+ $validate = new MemberValidate();
|
|
|
+ if (!$validate->scene('wechat')->check($params)) {
|
|
|
+ showJson(1004, $validate->getError());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证
|
|
|
+ $this->checkUser();
|
|
|
+
|
|
|
+ if (UserProfile::where(['userid' => $this->userId])->value('idcard_check') != 2) {
|
|
|
+ showJson(1006, 2132, ['url' => Wechat::makeRedirectUrl(url('/weixin/auth/idcard', '', '', true))]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $cacheKey = "cache:wechat:account:{$this->userId}";
|
|
|
+ if(PRedis::get($cacheKey)){
|
|
|
+ showJson(1004, 2049);
|
|
|
+ }
|
|
|
+ $wechatCode = input('wechat_code','');
|
|
|
+ if(UserProfile::where(['userid'=> $this->userId])->update(['wechat_code'=>$wechatCode,'updated_at'=>date('Y-m-d H:i:s')])){
|
|
|
+ PRedis::set($cacheKey, ['params'=> $params], 300);
|
|
|
+ showJson(1005, 2047);
|
|
|
+ }else{
|
|
|
+ showJson(1004,2048);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 关注用户
|
|
|
*/
|
|
|
public function collect()
|