|
|
|
@ -13,6 +13,7 @@ declare (strict_types=1); |
|
|
|
|
namespace app\admin\model; |
|
|
|
|
|
|
|
|
|
use app\admin\model\Page as PageModel; |
|
|
|
|
use app\admin\model\store\User; |
|
|
|
|
use app\common\model\Store as StoreModel; |
|
|
|
|
use app\admin\model\store\User as StoreUserModel; |
|
|
|
|
|
|
|
|
@ -92,6 +93,29 @@ class Store extends StoreModel |
|
|
|
|
public function auditStore(array $data) |
|
|
|
|
{ |
|
|
|
|
$storeInfo = $this->toArray(); |
|
|
|
|
print_r($storeInfo);exit; |
|
|
|
|
if($storeInfo['status'] != 0){ |
|
|
|
|
$this->error = '状态异常,请勿重复操作'; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
$user = User::where(['user_id' => $storeInfo['user_id']])->find(); |
|
|
|
|
if (StoreUserModel::checkExist($user['mobile'])) { |
|
|
|
|
$this->error = '商家用户名已存在'; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if($data['status'] == 1){ |
|
|
|
|
return $this->transaction(function () use ($data) { |
|
|
|
|
// 添加小程序记录 |
|
|
|
|
$data['is_recycle'] = 0; |
|
|
|
|
if ($status = $this->save($data)) { |
|
|
|
|
// 新增商家用户信息 |
|
|
|
|
(new StoreUserModel)->add((int)$this['store_id'], $data); |
|
|
|
|
// 新增默认首页数据 |
|
|
|
|
(new PageModel)->insertDefault((int)$this['store_id']); |
|
|
|
|
} |
|
|
|
|
return $status; |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|