|
|
@@ -15,8 +15,10 @@
|
|
|
namespace app\adminapi\logic\property;
|
|
|
|
|
|
|
|
|
+use app\adminapi\logic\user\UserLogic;
|
|
|
use app\common\model\property\PropertyHead;
|
|
|
use app\common\logic\BaseLogic;
|
|
|
+use app\common\model\user\User;
|
|
|
use think\facade\Db;
|
|
|
|
|
|
|
|
|
@@ -72,8 +74,18 @@ class PropertyHeadLogic extends BaseLogic
|
|
|
*/
|
|
|
public static function edit(array $params): bool
|
|
|
{
|
|
|
+ $headMobile = PropertyHead::where('id', $params['id'])->value('head_mobile');
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
+ // 手机号不同时做判断
|
|
|
+ if($headMobile != $params['head_mobile']){
|
|
|
+ $user = User::where(['mobile' => $params['head_mobile']])->findOrEmpty();
|
|
|
+ if (!$user->isEmpty()) {
|
|
|
+ throw new \Exception('该手机号已被注册');
|
|
|
+ }
|
|
|
+ // 更换用户手机号 account
|
|
|
+ User::where(['mobile' => $headMobile])->save(['mobile' => $params['head_mobile']]);
|
|
|
+ }
|
|
|
PropertyHead::where('id', $params['id'])->update([
|
|
|
'property_name' => $params['property_name'],
|
|
|
'village_name' => $params['village_name'],
|
|
|
@@ -87,6 +99,7 @@ class PropertyHeadLogic extends BaseLogic
|
|
|
'remark' => $params['remark']
|
|
|
]);
|
|
|
|
|
|
+
|
|
|
Db::commit();
|
|
|
return true;
|
|
|
} catch (\Exception $e) {
|