更新
This commit is contained in:
parent
b593600a92
commit
3cfd1c5ca8
@ -53,7 +53,6 @@ class MerchantLogic extends BaseLogic
|
|||||||
'lat' => $params['lat'] ?? '',
|
'lat' => $params['lat'] ?? '',
|
||||||
'service_phone' => $params['phone'],
|
'service_phone' => $params['phone'],
|
||||||
'service_user' => $params['service_user'] ?? '',
|
'service_user' => $params['service_user'] ?? '',
|
||||||
'mer_money' => $params['mer_money'] ?? 0,
|
|
||||||
'financial_bank' => $params['financial_bank'] ?? '',
|
'financial_bank' => $params['financial_bank'] ?? '',
|
||||||
'financial_wechat' => $params['financial_wechat'] ?? '',
|
'financial_wechat' => $params['financial_wechat'] ?? '',
|
||||||
'financial_alipay' => $params['financial_alipay'] ?? '',
|
'financial_alipay' => $params['financial_alipay'] ?? '',
|
||||||
@ -92,9 +91,9 @@ class MerchantLogic extends BaseLogic
|
|||||||
'category_id' => $params['category_id'],
|
'category_id' => $params['category_id'],
|
||||||
'type_id' => $params['type_id'] ?? '',
|
'type_id' => $params['type_id'] ?? '',
|
||||||
'mer_name' => $params['mer_name'],
|
'mer_name' => $params['mer_name'],
|
||||||
'credit_buy' => $params['credit_buy'],
|
'credit_buy' => $params['credit_buy'] ?? 0,
|
||||||
'settle_cycle' => $params['settle_cycle'],
|
'settle_cycle' => $params['settle_cycle'] ?? 15,
|
||||||
'interest_rate' => $params['interest_rate'],
|
'interest_rate' => $params['interest_rate'] ?? 0,
|
||||||
'province_id' => $params['province_id'] ?? '',
|
'province_id' => $params['province_id'] ?? '',
|
||||||
'city_id' => $params['city_id'] ?? '',
|
'city_id' => $params['city_id'] ?? '',
|
||||||
'area_id' => $params['area_id'] ?? '',
|
'area_id' => $params['area_id'] ?? '',
|
||||||
@ -102,20 +101,26 @@ class MerchantLogic extends BaseLogic
|
|||||||
'village_id' => $params['village_id'] ?? '',
|
'village_id' => $params['village_id'] ?? '',
|
||||||
'mer_address' => $params['mer_address'],
|
'mer_address' => $params['mer_address'],
|
||||||
'mer_avatar' => $params['mer_avatar'] ?? '',
|
'mer_avatar' => $params['mer_avatar'] ?? '',
|
||||||
'mark' => $params['mark'],
|
'mark' => $params['mark'] ?? '',
|
||||||
'sort' => $params['sort'],
|
'sort' => $params['sort'] ?? 99,
|
||||||
'status' => $params['status'],
|
'status' => $params['status'] ?? 0,
|
||||||
'commission_rate' => $params['commission_rate'] ?? '',
|
'commission_rate' => $params['commission_rate'] ?? '',
|
||||||
'commission_switch' => $params['commission_switch'] ?? '',
|
'commission_switch' => $params['commission_switch'] ?? '',
|
||||||
'long' => $params['long'] ?? '',
|
'long' => $params['long'] ?? '',
|
||||||
'lat' => $params['lat'] ?? '',
|
'lat' => $params['lat'] ?? '',
|
||||||
'service_phone' => $params['service_phone'],
|
'service_phone' => $params['phone'],
|
||||||
'service_user' => $params['service_user'],
|
'service_user' => $params['service_user']??'',
|
||||||
'mer_money' => $params['mer_money'],
|
|
||||||
'financial_bank' => $params['financial_bank'] ?? '',
|
'financial_bank' => $params['financial_bank'] ?? '',
|
||||||
'financial_wechat' => $params['financial_wechat'] ?? '',
|
'financial_wechat' => $params['financial_wechat'] ?? '',
|
||||||
'financial_alipay' => $params['financial_alipay'] ?? '',
|
'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();
|
Db::commit();
|
||||||
|
@ -51,7 +51,6 @@ class SupplierLogic extends BaseLogic
|
|||||||
'long' => $params['long'] ?? '',
|
'long' => $params['long'] ?? '',
|
||||||
'lat' => $params['lat'] ?? '',
|
'lat' => $params['lat'] ?? '',
|
||||||
'service_phone' => $params['phone'],
|
'service_phone' => $params['phone'],
|
||||||
'mer_money' => $params['mer_money']??0,
|
|
||||||
'financial_bank' => $params['financial_bank'] ?? '',
|
'financial_bank' => $params['financial_bank'] ?? '',
|
||||||
'financial_wechat' => $params['financial_wechat'] ?? '',
|
'financial_wechat' => $params['financial_wechat'] ?? '',
|
||||||
'financial_alipay' => $params['financial_alipay'] ?? '',
|
'financial_alipay' => $params['financial_alipay'] ?? '',
|
||||||
@ -142,11 +141,11 @@ class SupplierLogic extends BaseLogic
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Supplier::where('id', $params['id'])->update([
|
Supplier::where('id', $params['id'])->update([
|
||||||
'category_id' => $params['category_id'],
|
'category_id' => $params['category_id']??'',
|
||||||
'type_id' => $params['type_id'] ?? '',
|
'type_id' => $params['type_id'] ?? '',
|
||||||
'mer_name' => $params['mer_name'],
|
'mer_name' => $params['mer_name'],
|
||||||
'settle_cycle' => $params['settle_cycle'],
|
'settle_cycle' => $params['settle_cycle'] ?? 15,
|
||||||
'interest_rate' => $params['interest_rate'],
|
'interest_rate' => $params['interest_rate'] ?? 0,
|
||||||
'sys_labels' => $params['sys_labels'] ?? '',
|
'sys_labels' => $params['sys_labels'] ?? '',
|
||||||
'province_id' => $params['province_id'] ?? '',
|
'province_id' => $params['province_id'] ?? '',
|
||||||
'city_id' => $params['city_id'] ?? '',
|
'city_id' => $params['city_id'] ?? '',
|
||||||
@ -162,11 +161,17 @@ class SupplierLogic extends BaseLogic
|
|||||||
'long' => $params['long'] ?? '',
|
'long' => $params['long'] ?? '',
|
||||||
'lat' => $params['lat'] ?? '',
|
'lat' => $params['lat'] ?? '',
|
||||||
'service_phone' => $params['service_phone'],
|
'service_phone' => $params['service_phone'],
|
||||||
'mer_money' => $params['mer_money'],
|
|
||||||
'financial_bank' => $params['financial_bank'] ?? '',
|
'financial_bank' => $params['financial_bank'] ?? '',
|
||||||
'financial_wechat' => $params['financial_wechat'] ?? '',
|
'financial_wechat' => $params['financial_wechat'] ?? '',
|
||||||
'financial_alipay' => $params['financial_alipay'] ?? '',
|
'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();
|
Db::commit();
|
||||||
|
@ -30,14 +30,15 @@ class OpurchaseGoodsOfferController extends BaseApiController
|
|||||||
$page_size = $this->request->get('page_size', 15);
|
$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 = 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['name']=date('Y-m-d', $item['create_time']).' 报价清单';
|
||||||
// $item['supplier'] = $data;
|
|
||||||
// $item['apply_id'] = $item['id'];
|
|
||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
$count = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier['id'])->count();
|
$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]);
|
return $this->success('请求成功', ['lists' => $data, 'count' => $count, 'page_no' => $page_no, 'page_size' => $page_size]);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 提交报价
|
||||||
|
*/
|
||||||
public function offer()
|
public function offer()
|
||||||
{
|
{
|
||||||
if (!$this->request->userInfo['supplier']) return $this->fail('非供应商用户不能报价');
|
if (!$this->request->userInfo['supplier']) return $this->fail('非供应商用户不能报价');
|
||||||
|
@ -44,13 +44,24 @@ class IndexController extends BaseApiController{
|
|||||||
$post=$this->request->post();
|
$post=$this->request->post();
|
||||||
$shop_user_id= $this->get_x_token();
|
$shop_user_id= $this->get_x_token();
|
||||||
$post['shop_user_id']=$shop_user_id;
|
$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){
|
if($post['is_merchant_type']==1){
|
||||||
|
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);
|
$res=MerchantLogic::add($post);
|
||||||
|
}
|
||||||
if(MerchantLogic::hasError()){
|
if(MerchantLogic::hasError()){
|
||||||
return $this->fail(MerchantLogic::getError());
|
return $this->fail(MerchantLogic::getError());
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
if($find){
|
||||||
|
$res=SupplierLogic::edit($post);
|
||||||
|
Db::name('user_auth_shop')->where('id',$find['id'])->update(['apply_status'=>0,'mark'=>'']);
|
||||||
}else{
|
}else{
|
||||||
$res=SupplierLogic::add($post);
|
$res=SupplierLogic::add($post);
|
||||||
|
}
|
||||||
if(SupplierLogic::hasError()){
|
if(SupplierLogic::hasError()){
|
||||||
return $this->fail(SupplierLogic::getError());
|
return $this->fail(SupplierLogic::getError());
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace app\api\lists\operation;
|
|||||||
|
|
||||||
use app\admin\lists\BaseAdminDataLists;
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\goods\Goods;
|
||||||
use app\common\model\goods\Unit;
|
use app\common\model\goods\Unit;
|
||||||
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||||
|
|
||||||
@ -40,25 +41,36 @@ class OpurchaseGoodsOfferList extends BaseAdminDataLists implements ListsSearchI
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
$supplier_id=$this->request->userInfo['supplier']['id'] ?? 0;
|
$supplier_id=$this->request->userInfo['supplier']['id'] ?? 0;
|
||||||
|
if(!$supplier_id) return [];
|
||||||
$params = $this->request->get();
|
$params = $this->request->get();
|
||||||
if(isset($params['type']) && $params['type'] == 2){
|
if(isset($params['type']) && $params['type'] == 2){
|
||||||
$where[] = ['price','<>',0];
|
$where[] = ['price','<>',0];
|
||||||
$where[] = ['is_adopt','<>',0];
|
$where[] = ['is_adopt','<>',0];
|
||||||
|
$where[] = ['supplier_id','=',$supplier_id];
|
||||||
}else{
|
}else{
|
||||||
$where[] = ['price','=',''];
|
$where[] = ['price','=',0];
|
||||||
$where[] = ['is_adopt','=',0];
|
$where[] = ['is_adopt','=',0];
|
||||||
|
$where[] = ['supplier_id','=',$supplier_id];
|
||||||
}
|
}
|
||||||
if(!$supplier_id) return [];
|
if($params['date']){
|
||||||
return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)
|
$where[] = ['create_time','between',[strtotime($params['date']),strtotime($params['date'])+86400]];
|
||||||
->with('goods')
|
}else{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return OpurchaseGoodsOffer::where($this->searchWhere)->where($where)
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($data){
|
->select()->each(function($data){
|
||||||
$data['is_adopt_text'] = $data->is_adopt_text;
|
$data['is_adopt_text'] = $data->is_adopt_text;
|
||||||
if(!empty($data['goods'])){
|
$find = Goods::where('id', $data['goods_id'])->with('unitName')->find();
|
||||||
$unit = Unit::where('id',$data['goods']['unit'])->findOrEmpty();
|
if($find){
|
||||||
$data['goods']['unit_name'] = !$unit->isEmpty() ? $unit['name'] : '';
|
$goods['goods_name'] = $find['name'];
|
||||||
|
$goods['unit_name'] = $find['unit_name'];
|
||||||
|
$goods['imgs'] = $find['imgs'];
|
||||||
|
$data['goods']=$goods;
|
||||||
}
|
}
|
||||||
|
return $data;
|
||||||
|
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
@ -74,9 +86,9 @@ class OpurchaseGoodsOfferList extends BaseAdminDataLists implements ListsSearchI
|
|||||||
$supplier_id=$this->request->userInfo['supplier']['id'] ?? 0;
|
$supplier_id=$this->request->userInfo['supplier']['id'] ?? 0;
|
||||||
$params = $this->request->get();
|
$params = $this->request->get();
|
||||||
if(isset($params['type']) && $params['type'] == 2){
|
if(isset($params['type']) && $params['type'] == 2){
|
||||||
$where[] = ['price','<>',''];
|
$where[] = ['price','<>',0];
|
||||||
}else{
|
}else{
|
||||||
$where[] = ['price','=',''];
|
$where[] = ['price','=',0];
|
||||||
}
|
}
|
||||||
return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)->count();
|
return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)->count();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace app\api\logic\shop;
|
|||||||
|
|
||||||
use app\api\service\UserTokenService;
|
use app\api\service\UserTokenService;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\model\user\UserSession;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
class ShopLogic extends BaseLogic
|
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();
|
$user=Db::name('user_auth_shop')->where('shop_uid',$data['jti'][0])->where('apply_status',1)->find();
|
||||||
if($user){
|
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);
|
$userInfo = UserTokenService::setToken($user['user_id'], 6);
|
||||||
return $userInfo['token'];
|
return $userInfo['token'];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user