|
|
|
@ -117,29 +117,35 @@ class Store extends BaseService |
|
|
|
|
//申请入驻 |
|
|
|
|
public function joinStore($data, $user_id) |
|
|
|
|
{ |
|
|
|
|
$has = Db::query('select * from yoshop_store where user_id = ' . $user_id . ' and status != 2 and is_recycle = 0 and is_delete= 0'); |
|
|
|
|
// $has = Db::query('select * from yoshop_store where user_id = ' . $user_id . ' and status != 2 and is_recycle = 0 and is_delete= 0'); |
|
|
|
|
// if ($has) { |
|
|
|
|
// return ['code' => 1, 'msg' => '请勿重复申请入驻']; |
|
|
|
|
// } |
|
|
|
|
// //商城主体信息 |
|
|
|
|
// $addData = [ |
|
|
|
|
// 'store_name' => $data['store_name'], |
|
|
|
|
// 'user_id' => $user_id, |
|
|
|
|
// 'sort' => 100, |
|
|
|
|
// 'create_time' => time(), |
|
|
|
|
// 'update_time' => time(), |
|
|
|
|
// 'status' => 0 |
|
|
|
|
// ]; |
|
|
|
|
|
|
|
|
|
$has = Db::query('select * from yoshop_store_settle where user_id = ' . $user_id . ' and status != 2'); |
|
|
|
|
if ($has) { |
|
|
|
|
return ['code' => 1, 'msg' => '请勿重复申请入驻']; |
|
|
|
|
} |
|
|
|
|
//商城主体信息 |
|
|
|
|
$addData = [ |
|
|
|
|
'store_name' => $data['store_name'], |
|
|
|
|
'user_id' => $user_id, |
|
|
|
|
'sort' => 100, |
|
|
|
|
'create_time' => time(), |
|
|
|
|
'update_time' => time(), |
|
|
|
|
'status' => 0 |
|
|
|
|
]; |
|
|
|
|
try { |
|
|
|
|
// 新增记录 |
|
|
|
|
$model = new \app\admin\model\Store; |
|
|
|
|
$res = $model->insertGetId($addData); |
|
|
|
|
if (!$res) { |
|
|
|
|
throw new Exception($model->getError()); |
|
|
|
|
} |
|
|
|
|
// $model = new \app\admin\model\Store; |
|
|
|
|
// $res = $model->insertGetId($addData); |
|
|
|
|
// if (!$res) { |
|
|
|
|
// throw new Exception($model->getError()); |
|
|
|
|
// } |
|
|
|
|
//附加资料 |
|
|
|
|
$settleData = [ |
|
|
|
|
'store_id' => $res, |
|
|
|
|
'user_id' => $user_id, |
|
|
|
|
'store_id' => $this->storeId, |
|
|
|
|
'store_cat' => $data['store_cat'], |
|
|
|
|
'store_address' => $data['store_address'], |
|
|
|
|
'store_brand' => $data['store_brand'], |
|
|
|
@ -158,6 +164,7 @@ class Store extends BaseService |
|
|
|
|
'has_online_shop' => $data['has_online_shop'], |
|
|
|
|
'created_at' => time(), |
|
|
|
|
'store_type' => empty($data['has_online_shop']) ? json_encode([]) : json_encode($data['store_type']), |
|
|
|
|
'status' => 0//审核状态 |
|
|
|
|
]; |
|
|
|
|
$settleModel = new StoreSettle(); |
|
|
|
|
if (!$settleModel->insert($settleData)) { |
|
|
|
|