小组集中采购更新
This commit is contained in:
parent
a94d5e81f2
commit
1ea9fb9ea1
@ -197,6 +197,16 @@ class ProductRepository extends BaseRepository
|
||||
app()->make(SpuRepository::class)->create($product, $result->product_id, $activity_id, $productType);
|
||||
}
|
||||
$product = $result;
|
||||
if ($productType==0){
|
||||
$find=Db::name('merchant_address')->where('mer_id',$data['mer_id'])->find();
|
||||
if ($find && $find['street_id']!=0){
|
||||
$addsdata=[
|
||||
'address_id'=>$find['street_id'],
|
||||
'product_id'=>$result->product_id
|
||||
];
|
||||
Db::name('merchant_address_product')->insert($addsdata);
|
||||
}
|
||||
}
|
||||
event('product.create',compact('product'));
|
||||
return $result->product_id;
|
||||
});
|
||||
@ -1503,6 +1513,9 @@ class ProductRepository extends BaseRepository
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', $ids);
|
||||
Db::name('store_spu')->where('product_id','in',$ids)->update(['status'=>$status]);
|
||||
if ($product['product_type']==0){
|
||||
Db::name('merchant_address_product')->where('product_id','in',$ids)->update(['status'=>$status]);
|
||||
}
|
||||
$this->dao->updates($ids,[$is => $status]);
|
||||
}
|
||||
|
||||
|
@ -130,8 +130,23 @@ class MerchantRepository extends BaseRepository
|
||||
})->requiredNum(),
|
||||
|
||||
Elm::select('type_id', '店铺类型')->disabled($is_margin)->options($options)->requiredNum()->col(12)->control($margin),
|
||||
|
||||
|
||||
Elm::cascader('geo_street', '商圈')->options(function () {
|
||||
$slect=Db::name('geo_area')->where('city_code','510500')
|
||||
->withAttr('children',function ($value,$data){
|
||||
$select= Db::name('geo_street')->where('area_code',$data['value'])
|
||||
->field('street_code value,street_name label')
|
||||
->select();
|
||||
$arr=[];
|
||||
foreach ($select as $k=>$v){
|
||||
$v['value']=(int)$v['value'];
|
||||
$arr[]=$v;
|
||||
}
|
||||
return $arr;
|
||||
})
|
||||
->field('area_code value,area_name label')
|
||||
->select()->toArray();
|
||||
return $slect;
|
||||
})->props(['props' => ['checkStrictly' => true, 'emitPath' => false]])->filterable(true),
|
||||
Elm::input('mer_account', '商户账号')->required()->disabled(!is_null($id))->required(!is_null($id)),
|
||||
Elm::password('mer_password', '登录密码')->required()->disabled(!is_null($id))->required(!is_null($id)),
|
||||
Elm::input('real_name', '商户姓名'),
|
||||
@ -198,6 +213,8 @@ class MerchantRepository extends BaseRepository
|
||||
if($data['type_id'] == 0){
|
||||
$data['type_id'] = '';
|
||||
}
|
||||
$find=Db::name('merchant_address')->where('mer_id')->value('street_id');
|
||||
$data['geo_street']=$find;
|
||||
return $this->form($id, $data);
|
||||
}
|
||||
|
||||
@ -233,6 +250,7 @@ class MerchantRepository extends BaseRepository
|
||||
unset($data['mer_account'], $data['mer_password']);
|
||||
$merchant = $this->dao->create($data);
|
||||
$make->createMerchantAccount($merchant, $account, $password);
|
||||
Db::name('merchant_address')->insert(['mer_id'=>$merchant->mer_id,'street_id'=>$data['geo_street']]);
|
||||
app()->make(ShippingTemplateRepository::class)->createDefault($merchant->mer_id);
|
||||
app()->make(ProductCopyRepository::class)->defaulCopyNum($merchant->mer_id);
|
||||
return $merchant;
|
||||
|
@ -28,6 +28,7 @@ use think\App;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Queue;
|
||||
|
||||
/**
|
||||
@ -117,7 +118,6 @@ class Merchant extends BaseController
|
||||
{
|
||||
if (!$this->repository->exists($id))
|
||||
return app('json')->fail('数据不存在');
|
||||
|
||||
return app('json')->success(formToData($this->repository->updateForm($id)));
|
||||
}
|
||||
|
||||
@ -146,7 +146,12 @@ class Merchant extends BaseController
|
||||
$margin = $this->repository->checkMargin($id, $data['type_id']);
|
||||
$data['margin'] = $margin['margin'];
|
||||
$data['is_margin'] = $margin['is_margin'];
|
||||
$geo_street=$data['geo_street'];//添加商圈
|
||||
unset($data['geo_street']);
|
||||
$this->repository->update($id, $data);
|
||||
if ($geo_street){
|
||||
Db::name('merchant_address')->where('mer_id',$id)->update(['street_id'=>$geo_street]);
|
||||
}
|
||||
return app('json')->success('编辑成功');
|
||||
}
|
||||
|
||||
@ -176,7 +181,7 @@ class Merchant extends BaseController
|
||||
*/
|
||||
public function checkParam(MerchantValidate $validate, $isUpdate = false)
|
||||
{
|
||||
$data = $this->request->params([['category_id', 0], ['type_id', 0], 'mer_name', 'commission_rate', 'real_name', 'mer_phone', 'mer_keyword', 'mer_address', 'mark', ['sort', 0], ['status', 0], ['is_audit', 0], ['is_best', 0], ['is_bro_goods', 0], ['is_bro_room', 0], ['is_trader', 0],'sub_mchid']);
|
||||
$data = $this->request->params([['geo_street',0],['category_id', 0], ['type_id', 0], 'mer_name', 'commission_rate', 'real_name', 'mer_phone', 'mer_keyword', 'mer_address', 'mark', ['sort', 0], ['status', 0], ['is_audit', 0], ['is_best', 0], ['is_bro_goods', 0], ['is_bro_room', 0], ['is_trader', 0],'sub_mchid']);
|
||||
if (!$isUpdate) {
|
||||
$data += $this->request->params(['mer_account', 'mer_password']);
|
||||
}else {
|
||||
|
@ -52,6 +52,7 @@ class Auth extends BaseController
|
||||
{
|
||||
$data['tempCode'] = 'ORDER_PAY_SUCCESS';
|
||||
$data['id'] = '8';
|
||||
halt($data);
|
||||
app()->make(WechatTemplateMessageService::class)->sendTemplate($data);
|
||||
}
|
||||
|
||||
@ -380,15 +381,12 @@ class Auth extends BaseController
|
||||
$tokenInfo = $repository->createToken($user);
|
||||
$repository->loginAfter($user);
|
||||
$find=Db::name('nk_user')->where('user_id',$user['uid'])->find();
|
||||
$user['no_update']=1;
|
||||
if ($find && $find['n_user_id']!=0){
|
||||
$msg=Db::connect('nongke')->name('szxc_information_usermsg')->where('user_id',$find['n_user_id'])->cache(true)->find();
|
||||
if ($msg){
|
||||
$user['no_update']=0;
|
||||
}else{
|
||||
$user['no_update']=1;
|
||||
}
|
||||
}else{
|
||||
$user['no_update']=1;
|
||||
}
|
||||
if ($user['phone']==''){
|
||||
Db::name('user')->where('uid',$user['uid'])->update(['phone'=>$user['account']]);
|
||||
|
@ -17,6 +17,7 @@ use crmeb\services\CopyCommand;
|
||||
use think\App;
|
||||
use crmeb\basic\BaseController;
|
||||
use app\common\repositories\store\product\SpuRepository;
|
||||
use think\facade\Db;
|
||||
|
||||
class StoreSpu extends BaseController
|
||||
{
|
||||
@ -64,6 +65,42 @@ class StoreSpu extends BaseController
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**代购列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function agency_list(){
|
||||
// [$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params([
|
||||
'keyword',
|
||||
'cate_id',
|
||||
'cate_pid',
|
||||
'order',
|
||||
'price_on',
|
||||
'price_off',
|
||||
'brand_id',
|
||||
'pid',
|
||||
'mer_cate_id',
|
||||
'product_type',
|
||||
'action',
|
||||
'common',
|
||||
'is_trader',
|
||||
'product_ids',
|
||||
'mer_id'
|
||||
]);
|
||||
$where['is_gift_bag'] = 0;
|
||||
$where['product_type'] = 0;
|
||||
$where['order'] = $where['order'] ? $where['order'] : 'star';
|
||||
if ($where['is_trader'] != 1) unset($where['is_trader']);
|
||||
$data=Db::name('merchant_address_product')->alias('a')
|
||||
->where('a.address_id',510504100)
|
||||
->where('a.status',1)
|
||||
->join('store_product p','a.product_id=p.product_id')
|
||||
->field('p.product_id,p.store_name,p.sales,p.price,p.image')
|
||||
->select();
|
||||
$count=Db::name('merchant_address_product')->where('address_id',510504100)
|
||||
->where('status',1)->count();
|
||||
return app('json')->success(['count'=>$count,'list'=>$data]);
|
||||
}
|
||||
/**
|
||||
* TODO 商户的商品搜索列表
|
||||
* @param $id
|
||||
|
@ -429,6 +429,9 @@ Route::group('api/', function () {
|
||||
Route::get('/coupon_product', 'StoreSpu/getProductByCoupon');
|
||||
//热卖排行
|
||||
Route::get('/get_hot_ranking', 'StoreSpu/getHotRanking');
|
||||
|
||||
Route::get('/agency_list', 'StoreSpu/agency_list');
|
||||
|
||||
})->prefix('api.store.product.');
|
||||
|
||||
//直播
|
||||
|
Loading…
x
Reference in New Issue
Block a user