This commit is contained in:
mkm 2024-05-18 15:28:17 +08:00
parent b593600a92
commit 3cfd1c5ca8
6 changed files with 72 additions and 32 deletions

View File

@ -53,7 +53,6 @@ class MerchantLogic extends BaseLogic
'lat' => $params['lat'] ?? '',
'service_phone' => $params['phone'],
'service_user' => $params['service_user'] ?? '',
'mer_money' => $params['mer_money'] ?? 0,
'financial_bank' => $params['financial_bank'] ?? '',
'financial_wechat' => $params['financial_wechat'] ?? '',
'financial_alipay' => $params['financial_alipay'] ?? '',
@ -92,9 +91,9 @@ class MerchantLogic extends BaseLogic
'category_id' => $params['category_id'],
'type_id' => $params['type_id'] ?? '',
'mer_name' => $params['mer_name'],
'credit_buy' => $params['credit_buy'],
'settle_cycle' => $params['settle_cycle'],
'interest_rate' => $params['interest_rate'],
'credit_buy' => $params['credit_buy'] ?? 0,
'settle_cycle' => $params['settle_cycle'] ?? 15,
'interest_rate' => $params['interest_rate'] ?? 0,
'province_id' => $params['province_id'] ?? '',
'city_id' => $params['city_id'] ?? '',
'area_id' => $params['area_id'] ?? '',
@ -102,20 +101,26 @@ class MerchantLogic extends BaseLogic
'village_id' => $params['village_id'] ?? '',
'mer_address' => $params['mer_address'],
'mer_avatar' => $params['mer_avatar'] ?? '',
'mark' => $params['mark'],
'sort' => $params['sort'],
'status' => $params['status'],
'mark' => $params['mark'] ?? '',
'sort' => $params['sort'] ?? 99,
'status' => $params['status'] ?? 0,
'commission_rate' => $params['commission_rate'] ?? '',
'commission_switch' => $params['commission_switch'] ?? '',
'long' => $params['long'] ?? '',
'lat' => $params['lat'] ?? '',
'service_phone' => $params['service_phone'],
'service_user' => $params['service_user'],
'mer_money' => $params['mer_money'],
'service_phone' => $params['phone'],
'service_user' => $params['service_user']??'',
'financial_bank' => $params['financial_bank'] ?? '',
'financial_wechat' => $params['financial_wechat'] ?? '',
'financial_alipay' => $params['financial_alipay'] ?? '',
'financial_type' => $params['financial_type'] ?? ''
'financial_type' => $params['financial_type'] ?? '',
'data_json' => json_encode([
'company_address' => $params['address'] ?? '',
'company_nickname' => $params['nickname'] ?? '',
'social_credit_code' => $params['social_credit_code'] ?? '',
'company_name' => $params['company_name'] ?? '',
'images' => $params['images'][0] ?? '',
])
]);
Db::commit();

View File

@ -51,7 +51,6 @@ class SupplierLogic extends BaseLogic
'long' => $params['long'] ?? '',
'lat' => $params['lat'] ?? '',
'service_phone' => $params['phone'],
'mer_money' => $params['mer_money']??0,
'financial_bank' => $params['financial_bank'] ?? '',
'financial_wechat' => $params['financial_wechat'] ?? '',
'financial_alipay' => $params['financial_alipay'] ?? '',
@ -142,11 +141,11 @@ class SupplierLogic extends BaseLogic
Db::startTrans();
try {
Supplier::where('id', $params['id'])->update([
'category_id' => $params['category_id'],
'category_id' => $params['category_id']??'',
'type_id' => $params['type_id'] ?? '',
'mer_name' => $params['mer_name'],
'settle_cycle' => $params['settle_cycle'],
'interest_rate' => $params['interest_rate'],
'settle_cycle' => $params['settle_cycle'] ?? 15,
'interest_rate' => $params['interest_rate'] ?? 0,
'sys_labels' => $params['sys_labels'] ?? '',
'province_id' => $params['province_id'] ?? '',
'city_id' => $params['city_id'] ?? '',
@ -162,11 +161,17 @@ class SupplierLogic extends BaseLogic
'long' => $params['long'] ?? '',
'lat' => $params['lat'] ?? '',
'service_phone' => $params['service_phone'],
'mer_money' => $params['mer_money'],
'financial_bank' => $params['financial_bank'] ?? '',
'financial_wechat' => $params['financial_wechat'] ?? '',
'financial_alipay' => $params['financial_alipay'] ?? '',
'financial_type' => $params['financial_type'] ?? ''
'financial_type' => $params['financial_type'] ?? '',
'data_json'=>json_encode([
'company_address' => $params['address'] ?? '',
'company_nickname' => $params['nickname'] ?? '',
'social_credit_code' => $params['social_credit_code'] ?? '',
'company_name' => $params['company_name'] ?? '',
'images'=>$params['images'][0] ?? '',
])
]);
Db::commit();

View File

@ -30,14 +30,15 @@ class OpurchaseGoodsOfferController extends BaseApiController
$page_size = $this->request->get('page_size', 15);
$data = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier['id'])->page($page_no, $page_size)->select()->each(function ($item) {
// $data = Supplier::where('id', $item['pid'])->find();
// $item['supplier'] = $data;
// $item['apply_id'] = $item['id'];
$item['name']=date('Y-m-d', $item['create_time']).' 报价清单';
return $item;
})->toArray();
$count = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier['id'])->count();
return $this->success('请求成功', ['lists' => $data, 'count' => $count, 'page_no' => $page_no, 'page_size' => $page_size]);
}
/**
* 提交报价
*/
public function offer()
{
if (!$this->request->userInfo['supplier']) return $this->fail('非供应商用户不能报价');

View File

@ -44,13 +44,24 @@ class IndexController extends BaseApiController{
$post=$this->request->post();
$shop_user_id= $this->get_x_token();
$post['shop_user_id']=$shop_user_id;
$find=Db::name('user_auth_shop')->where('shop_uid',$post['shop_user_id'])->find();
if($post['is_merchant_type']==1){
$res=MerchantLogic::add($post);
if($find){
$res=MerchantLogic::edit($post);
Db::name('user_auth_shop')->where('id',$find['id'])->update(['apply_status'=>0,'mark'=>'']);
}else{
$res=MerchantLogic::add($post);
}
if(MerchantLogic::hasError()){
return $this->fail(MerchantLogic::getError());
}
}else{
$res=SupplierLogic::add($post);
if($find){
$res=SupplierLogic::edit($post);
Db::name('user_auth_shop')->where('id',$find['id'])->update(['apply_status'=>0,'mark'=>'']);
}else{
$res=SupplierLogic::add($post);
}
if(SupplierLogic::hasError()){
return $this->fail(SupplierLogic::getError());
}

View File

@ -5,6 +5,7 @@ namespace app\api\lists\operation;
use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\goods\Goods;
use app\common\model\goods\Unit;
use app\common\model\opurchase\OpurchaseGoodsOffer;
@ -40,25 +41,36 @@ class OpurchaseGoodsOfferList extends BaseAdminDataLists implements ListsSearchI
public function lists(): array
{
$supplier_id=$this->request->userInfo['supplier']['id'] ?? 0;
if(!$supplier_id) return [];
$params = $this->request->get();
if(isset($params['type']) && $params['type'] == 2){
$where[] = ['price','<>',0];
$where[] = ['is_adopt','<>',0];
$where[] = ['supplier_id','=',$supplier_id];
}else{
$where[] = ['price','=',''];
$where[] = ['price','=',0];
$where[] = ['is_adopt','=',0];
$where[] = ['supplier_id','=',$supplier_id];
}
if(!$supplier_id) return [];
return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)
->with('goods')
if($params['date']){
$where[] = ['create_time','between',[strtotime($params['date']),strtotime($params['date'])+86400]];
}else{
return [];
}
return OpurchaseGoodsOffer::where($this->searchWhere)->where($where)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['is_adopt_text'] = $data->is_adopt_text;
if(!empty($data['goods'])){
$unit = Unit::where('id',$data['goods']['unit'])->findOrEmpty();
$data['goods']['unit_name'] = !$unit->isEmpty() ? $unit['name'] : '';
}
$find = Goods::where('id', $data['goods_id'])->with('unitName')->find();
if($find){
$goods['goods_name'] = $find['name'];
$goods['unit_name'] = $find['unit_name'];
$goods['imgs'] = $find['imgs'];
$data['goods']=$goods;
}
return $data;
})
->toArray();
}
@ -74,9 +86,9 @@ class OpurchaseGoodsOfferList extends BaseAdminDataLists implements ListsSearchI
$supplier_id=$this->request->userInfo['supplier']['id'] ?? 0;
$params = $this->request->get();
if(isset($params['type']) && $params['type'] == 2){
$where[] = ['price','<>',''];
$where[] = ['price','<>',0];
}else{
$where[] = ['price','=',''];
$where[] = ['price','=',0];
}
return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)->count();
}

View File

@ -4,6 +4,7 @@ namespace app\api\logic\shop;
use app\api\service\UserTokenService;
use app\common\logic\BaseLogic;
use app\common\model\user\UserSession;
use think\facade\Db;
class ShopLogic extends BaseLogic
@ -19,6 +20,11 @@ class ShopLogic extends BaseLogic
}
$user=Db::name('user_auth_shop')->where('shop_uid',$data['jti'][0])->where('apply_status',1)->find();
if($user){
$userSession = UserSession::where([['user_id', '=', $user['user_id']], ['terminal', '=', 6]])->find();
if($userSession){
UserTokenService::overtimeToken($userSession['token']);
return $userSession['token'];
}
$userInfo = UserTokenService::setToken($user['user_id'], 6);
return $userInfo['token'];
}