更新逛逛
This commit is contained in:
parent
d54cbd1c57
commit
59720e23ee
@ -126,12 +126,13 @@ class CommunityRepository extends BaseRepository
|
||||
$list=[];
|
||||
return compact('count','list');
|
||||
}
|
||||
$village_id=Db::name('nk_user')->where('user_id',$userInfo->uid)->value('village_id');
|
||||
if (!$village_id){
|
||||
$n_user_id=Db::name('nk_user')->where('user_id',$userInfo->uid)->value('n_user_id');
|
||||
if ($n_user_id==0 ||$n_user_id==''){
|
||||
$count=0;
|
||||
$list=[];
|
||||
return compact('count','list');
|
||||
}
|
||||
$village_id = Db::connect('nongke')->table('fa_szxc_information_useraddress')->where('user_id',$n_user_id)->value('village_id');
|
||||
$arr=Db::name('community_address')->where('village_id',$village_id)->page($page, $limit)->select();
|
||||
if (count($arr)==0){
|
||||
$count=0;
|
||||
|
@ -120,9 +120,8 @@ class MerchantRepository extends BaseRepository
|
||||
$merchantTypeRepository = app()->make(MerchantTypeRepository::class);
|
||||
$options = $merchantTypeRepository->getOptions();
|
||||
$margin = $merchantTypeRepository->getMargin();
|
||||
|
||||
$formData['geo_street']=Db::name('merchant_address')->where('mer_id',$id)->find();
|
||||
$config = systemConfig(['broadcast_room_type', 'broadcast_goods_type']);
|
||||
|
||||
$rule = [
|
||||
Elm::input('mer_name', '商户名称')->required(),
|
||||
Elm::select('category_id', '商户分类')->options(function () use ($make) {
|
||||
@ -253,7 +252,8 @@ class MerchantRepository extends BaseRepository
|
||||
|
||||
$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']]);
|
||||
$adds=['mer_id'=>$merchant->mer_id,'area_id'=>$data['geo_street'][0],'street_id'=>$data['geo_street'][1],'village_id'=>$data['geo_street'][2]];
|
||||
Db::name('merchant_address')->insert($adds);
|
||||
app()->make(ShippingTemplateRepository::class)->createDefault($merchant->mer_id);
|
||||
app()->make(ProductCopyRepository::class)->defaulCopyNum($merchant->mer_id);
|
||||
return $merchant;
|
||||
|
@ -150,7 +150,14 @@ class Merchant extends BaseController
|
||||
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]);
|
||||
$adds=Db::name('merchant_address')->where('mer_id',$id)->find();
|
||||
if($adds){
|
||||
$adds1=['area_id'=>$geo_street[0],'street_id'=>$geo_street[1],'village_id'=>$geo_street[2]];
|
||||
Db::name('merchant_address')->where('mer_id',$id)->update($adds1);
|
||||
}else{
|
||||
$adds1=['mer_id'=>$id,'area_id'=>$geo_street[0],'street_id'=>$geo_street[1],'village_id'=>$geo_street[2]];
|
||||
Db::name('merchant_address')->insert($adds1);
|
||||
}
|
||||
}
|
||||
return app('json')->success('编辑成功');
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ declare (strict_types=1);
|
||||
namespace app\listener;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
class CommunityAddress
|
||||
{
|
||||
@ -14,8 +15,9 @@ class CommunityAddress
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
$find = Db::name('nk_user')->where('user_id', $event['uid'])->find();
|
||||
if ($find && $find['village_id'] != 0) {
|
||||
$finds = Db::name('nk_user')->where('user_id', $event['uid'])->find();
|
||||
$find = Db::connect('nongke')->table('fa_szxc_information_useraddress')->where('user_id', $finds['n_user_id'])->find();
|
||||
if ($find ) {
|
||||
$data = [
|
||||
'user_id' => $event['uid'],
|
||||
'area_id' => $find['area_id'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user