Commit c08df54b by lizhilin

更新

parent 6b3ef861
......@@ -48,6 +48,9 @@ protected function grid()
// 更改为 panel 布局
$filter->panel();
$filter->like('name')->width(3);
$filter->equal('province_id', '省份')->select(City::where('parent_id', 0)->get()->pluck('name', 'city_id'))->load('city_id', '/city')->width(3);
// 城市
$filter->equal('city_id', '城市')->select()->width(3);
$filter->like('contacts', '联系人')->width(3);
$filter->like('phone')->width(3);
$filter->like('buycode')->width(3);
......
......@@ -62,7 +62,7 @@ public function handle(array $input)
public function form()
{
$this->display('current', '当前直购码');
$this->text('buycode', '修改直购码');
$this->text('buycode', '修改直购码')->help('输入4位随机数字');
$this->hidden('userid');
}
......
......@@ -33,7 +33,7 @@ public function getList()
'brief' => $item->brief,
'cover' => $item->cover ? env('IMAGE_URL') . $item->cover : '',
'content' => $item->content,
'created_at' => $item->created_at,
'created_at' => $item->created_at ? date("Y-m-d H:i:s", strtotime($item->created_at)) : '',
];
}
}
......
......@@ -49,7 +49,7 @@ public function add(Request $request)
$count = OrderGoods::where('order_id', $oid)->where('is_comment', 0)->count();
//Log::add('订单商品评论' . $og_id, ['num' => $count]);
if ($count == 0) {
//$this->dispatch(new AutoCompleteOrder($orderObj, 120));
$this->dispatch(new AutoCompleteOrder($orderObj, 120));
}
return $this->JsonResponse('');
} catch (\Exception $exception) {
......
......@@ -307,7 +307,7 @@ public function getAttrKey(Request $request)
return $this->JsonResponse('', '参数错误', 201);
}
$attrObj = GoodSku::where("attr_sn", $attr_sn)->first();
$attrObj = GoodSku::where('goods_id', $goods_id)->where("attr_sn", $attr_sn)->first();
if (!$attrObj) {
return $this->JsonResponse('', '参数错误', 201);
}
......
......@@ -80,6 +80,7 @@ public function info(Request $request)
'user_id' => $muser->id,
'username' => $muser->username,
'merchant_name' => $muser->name,
'phone' => $muser->phone,
'avatar' => $muser->avatar ? env('IMAGE_URL') . $muser->avatar : env('NO_AVATAR_IMAGE_URL'),
'merchant_id' => $muser->merchant_id,
'buycode' => $buycode,
......
......@@ -236,6 +236,9 @@ public function editUser(Request $request)
if ($name) {
$user->name = $name;
}
if (stripos($avatar, 'wximg') !== false) {
$avatar = '';
}
if ($avatar) {
if (is_file(public_path() . '/uploads' . $user->avatar)) {
unlink(public_path() . '/uploads' . $user->avatar);
......
......@@ -83,11 +83,23 @@ public static function payNotify($fields = [])
$mer_id = $item->merchant_id;
$goods_number = $item->goods_number;
$goodsObj = Good::find($gid);
//更新商品规格库存
$attrObj = GoodSku::find($attr_id);
$attr_stock = ($attrObj->stock - $goods_number) > 0 ? $attrObj->stock - $goods_number : 0;
$attrObj->stock = $attr_stock;
$attrObj->save();
//更新商品sku
$skuArr = json_decode($goodsObj->sku, true);
if ($skuArr['sku']) {
foreach ($skuArr['sku'] as $kk => $vv) {
if (isset($vv['attr_sn']) && $vv['attr_sn'] == $attrObj->attr_sn) {
$skuArr['sku'][$kk]['stock'] = $attr_stock;
}
}
$goodsObj->sku = json_encode($skuArr, JSON_UNESCAPED_UNICODE);
$goodsObj->save();
}
//商户规格库存
$mgsObj = MerchantGoodSku::where(['goods_id' => $gid, 'attr_id' => $attr_id, 'merchant_id' => $mer_id])->first();
if ($mer_id && $mgsObj) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment