门店入驻

wysf
ztt 9 months ago
parent 2fa9595730
commit bcc28e4675
  1. 5
      app/api/model/RecoveryOrder.php
  2. 39
      app/api/service/Store.php
  3. 18
      app/common/model/store/StoreSettle.php

@ -55,7 +55,10 @@ class RecoveryOrder extends BaseRecoveryOrder
public function getDetails(int $orderId)
{
$where['order_id'] = $orderId;
$where['user_id'] = UserService::getCurrentLoginUserId();
//不是店长带上 use_id
if(!UserService::isStore()) {
$where['user_id'] = UserService::getCurrentLoginUserId();
}
return static::detail($where, ['images.file']);
}

@ -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)) {

@ -29,4 +29,22 @@ class StoreSettle extends BaseModel
// 定义主键
protected $pk = 'id';
protected $append = [
'status_text'
];
protected function getStatusText($value, $data): string
{
if ($data['status'] == 0) {
return '待审核';
}
if ($data['status'] == 1) {
return '审核通过';
}
if ($data['status'] == 2) {
return '审核拒绝';
}
return "";
}
}

Loading…
Cancel
Save