调整补贴列表
This commit is contained in:
parent
2b732fb5f4
commit
8e72121a32
@ -3,6 +3,7 @@
|
||||
namespace app\common\model\store\coupon;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* Class StoreCouponDetail
|
||||
@ -61,6 +62,11 @@ class StoreCouponDetail extends BaseModel
|
||||
return $this->hasOne(StoreCouponUser::class, 'coupon_user_id', 'coupon_user_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'uid', 'uid');
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用优惠券
|
||||
* @param $order
|
||||
|
@ -387,4 +387,9 @@ class User extends BaseModel
|
||||
return Merchant::where('uid', $this->uid)->value('mer_id');
|
||||
}
|
||||
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'uid', 'uid');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,12 @@
|
||||
|
||||
namespace app\controller\admin\system\financial;
|
||||
|
||||
use app\common\model\store\coupon\StoreCoupon;
|
||||
use app\common\model\store\coupon\StoreCouponDetail;
|
||||
use app\common\repositories\store\coupon\StoreCouponRepository;
|
||||
use crmeb\basic\BaseController;
|
||||
use think\App;
|
||||
use think\db\Query;
|
||||
|
||||
class Subsidy extends BaseController
|
||||
{
|
||||
@ -17,10 +20,29 @@ class Subsidy extends BaseController
|
||||
public function index()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$query = StoreCouponDetail::where('status', StoreCouponDetail::STATUS_INVALID)
|
||||
$type = $this->request->get('type', '');
|
||||
$status = $this->request->get('status', '');
|
||||
$query = StoreCouponDetail::with(['user' => function (Query $query) {
|
||||
$query->with(['merchant' => function (Query $query) {
|
||||
$query->field('mer_id,uid,mer_name');
|
||||
}])->field('uid,nickname,avatar');
|
||||
}])
|
||||
->where('status', StoreCouponDetail::STATUS_INVALID)
|
||||
->where('type', StoreCouponDetail::TYPE_INCOME);
|
||||
if (!empty($type)) {
|
||||
if ($type == 1) {
|
||||
$couponWhere = ['type' => StoreCouponRepository::TYPE_STORE_COUPON];
|
||||
} else {
|
||||
$couponWhere = ['type' => StoreCouponRepository::TYPE_SALE_SUBSIDY];
|
||||
}
|
||||
$couponId = StoreCoupon::where($couponWhere)->value('coupon_id');
|
||||
$query->where('coupon_id', $couponId);
|
||||
}
|
||||
if ($status !== '') {
|
||||
$query->where('send_status', $status);
|
||||
}
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->order('id desc')->select()->toArray();
|
||||
$list = $query->page($page, $limit)->order('send_status asc')->order('id desc')->select()->toArray();
|
||||
$append = ['field' => 'send_status', 'value' => 'send_status_name', 'relation' => StoreCouponDetail::SEND_STATUS_MAP];
|
||||
$list = append_to_array($list, $append);
|
||||
return app('json')->success(['count' => $count, 'list'=> $list]);
|
||||
|
@ -194,7 +194,6 @@ class StoreOrder extends BaseController
|
||||
break;
|
||||
default: //快递
|
||||
$data = $this->request->params([
|
||||
'delivery_type',
|
||||
'delivery_type',
|
||||
'delivery_name',
|
||||
'delivery_id',
|
||||
|
@ -358,13 +358,13 @@ class StoreOrder extends BaseController
|
||||
{
|
||||
$user = $this->request->userInfo();
|
||||
if (empty($user['withdrawal_pwd'])) {
|
||||
return app('json')->fail(['msg' => '请设置支付密码', 'code'=> 101]);
|
||||
return app('json')->success(['msg' => '请设置支付密码', 'code'=> 101]);
|
||||
}
|
||||
$transPwd = $this->request->post('withdrawal_pwd');
|
||||
if (!password_verify((string)$transPwd, $user['withdrawal_pwd'])) {
|
||||
return app('json')->fail(['msg' => '支付密码错误', 'code'=> 102]);
|
||||
return app('json')->success(['msg' => '支付密码错误', 'code'=> 102]);
|
||||
}
|
||||
return app('json')->success('验证通过');
|
||||
return app('json')->success(['msg' => '验证通过', 'code'=> 100]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,6 +57,11 @@ class OrderDeliveryListen implements ListenerInterface
|
||||
$userCouponRepo->onlyDetail = true;
|
||||
$userCouponRepo->detailStatus = StoreCouponDetail::STATUS_INVALID;
|
||||
$userCouponRepo->sendStatus = StoreCouponDetail::SEND_REPEAL;
|
||||
$userCouponRepo->extra = [
|
||||
'sale_target' => $couponTotal,
|
||||
'purchase_target' => $couponTotal * 0.4,
|
||||
'official_purchase_target' => $couponTotal * 0.6,
|
||||
];
|
||||
$userCouponRepo->send();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user