Quellcode durchsuchen

更新用户名

shish vor 6 Jahren
Ursprung
Commit
fc8c01a0e4
2 geänderte Dateien mit 16 neuen und 2 gelöschten Zeilen
  1. 9 2
      biz/user/classes/UserClass.php
  2. 7 0
      console/controllers/InitController.php

+ 9 - 2
biz/user/classes/UserClass.php

@@ -594,10 +594,17 @@ class UserClass extends BaseClass
 				$val['openId'] = $val['openid'];
 				$val['nickName'] = $val['nickName'];
 				$val['merchantId'] = $merchantId;
-				self::replaceUser($val, $source, $merchantId);
+				$currentUser = self::getByCondition(['unionId'=>$val['unionid']],true);
+				$currentUser->userName = $val['nickName'];
+				$currentUser->nickName = $val['nickName'];
+				$currentUser->save();
+				echo $val['nickName'].'-|-'.$val['unionid'];
+				die;
+				//self::replaceUser($val, $source, $merchantId);
 			}
 		}
+		echo 'ok';
 		return ['total' => $total, 'count' => $count, 'nextOpenId' => $next_openid];
 	}
-	
+
 }

+ 7 - 0
console/controllers/InitController.php

@@ -104,4 +104,11 @@ class InitController extends Controller
 		xhMerchantAssetService::updateByMerchantId($merchantId, ['totalFans' => $total]);
 	}
 
+	//更新用户名称
+	public function actionUpdateName()
+	{
+		$merchantId = 12362;
+		UserService::syncWxAllUser($merchantId);
+	}
+	
 }