后台审核更新商户
This commit is contained in:
parent
c415e94f88
commit
1a75f8fec9
@ -12,8 +12,10 @@
|
||||
|
||||
namespace app\common\repositories\system\merchant;
|
||||
|
||||
use app\common\Enum;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\system\merchant\MerchantCategory;
|
||||
use app\common\model\system\merchant\MerchantIntention;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\system\config\ConfigValueRepository;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
@ -38,6 +40,7 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
|
||||
public function getList(array $where, $page, $limit)
|
||||
{
|
||||
// $where['type'] = [1,2];
|
||||
$query = $this->dao->search($where);
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->order('create_time DESC , status ASC')->with(['merchantCategory', 'merchantType'])->select();
|
||||
@ -47,6 +50,7 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
|
||||
public function getMoreList(array $where, $page, $limit)
|
||||
{
|
||||
$where['type'] = [3,4];//批发零售
|
||||
$query = $this->dao->search($where);
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)
|
||||
@ -126,25 +130,33 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
*/
|
||||
public function updateIdent($id, $data)
|
||||
{
|
||||
$wholesale = $data['wholesale'];
|
||||
$uid = $data['uid'];
|
||||
unset($data['mer_type_id']);
|
||||
unset($data['wholesale']);
|
||||
unset($data['uid']);
|
||||
|
||||
if($wholesale){
|
||||
//通过就 更改商户的身份
|
||||
$intention = $this->search(['mer_intention_id' => $id])->find();
|
||||
if (!$intention)
|
||||
throw new ValidateException('信息不存在');
|
||||
$uid = $intention->uid;
|
||||
if($data['status'] == 1){
|
||||
$check = Merchant::getDB()->where('uid', $uid)->value('mer_id');//商户
|
||||
|
||||
if($check){
|
||||
Merchant::getDB()->where('mer_id',$check)->update(['wholesale'=>$wholesale]);
|
||||
$wholesale = 0;
|
||||
if ($intention->mer_type_id == Enum::TypeSupplyChain) {//批发
|
||||
$wholesale = 1;
|
||||
}
|
||||
|
||||
if ($intention->mer_type_id == Enum::RetailMerchants) {//批发+零售
|
||||
$wholesale = 2;
|
||||
}
|
||||
if ($wholesale) {
|
||||
Merchant::getDB()->where('mer_id',$check)->update(['wholesale'=>$wholesale]);
|
||||
}
|
||||
|
||||
}else{
|
||||
throw new ValidateException('先成为商户');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$intention = $this->search(['mer_intention_id' => $id])->find();
|
||||
if (!$intention)
|
||||
throw new ValidateException('信息不存在');
|
||||
$intention->save($data);
|
||||
}
|
||||
|
||||
@ -226,7 +238,7 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
'site' => systemConfig('site_name'),
|
||||
];
|
||||
}
|
||||
|
||||
$data['update_time'] = date('Y-m-d H:i:s',time());
|
||||
Db::transaction(function () use ($config, $intention, $data, $create,$margin,$merData,$smsData,$autoCreate) {
|
||||
if ($data['status'] == 1) {
|
||||
if ($create == 1) {
|
||||
|
@ -91,17 +91,8 @@ class MerchantIntention extends BaseController
|
||||
{
|
||||
if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
||||
return app('json')->fail('数据不存在');
|
||||
$data = $this->request->params(['status','mer_type_id','uid']);
|
||||
if(empty($data['status']) || empty($data['mer_type_id']) || empty($data['uid']) ) return app('json')->fail('缺失参数');
|
||||
$data['wholesale'] = 0;
|
||||
if($data['status'] == 1){
|
||||
if($data['mer_type_id'] == 23){
|
||||
//批发
|
||||
$data['wholesale'] =1;
|
||||
}else{
|
||||
$data['wholesale'] =2;//零售
|
||||
}
|
||||
}
|
||||
$data = $this->request->params(['status','fail_msg']);
|
||||
if(empty($data['status'])) return app('json')->fail('缺失参数');
|
||||
$this->repository->updateIdent($id, $data);
|
||||
return app('json')->success('修改身份成功');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user