优化代码

main
home.fengxinyhyl 7 months ago
parent f250642f1b
commit d2a37de243
  1. 6
      app/common/repositories/user/UserAssetsLogRepository.php
  2. 2
      app/controller/admin/system/Lottery.php
  3. 2
      public/system.html
  4. 15
      view/admin/src/views/user/prize/index.vue

@ -356,7 +356,7 @@ class UserAssetsLogRepository extends BaseRepository
continue; continue;
} }
$item = $hotRepository->getWhere(['product_id' => $productItem['product_id'], 'uid' => $order['uid']]); $item = $hotRepository->getWhere(['uid' => $order['uid']]);
if ($item) { if ($item) {
$item['total'] += $product['hot_integral_total'] * $productItem['product_num']; $item['total'] += $product['hot_integral_total'] * $productItem['product_num'];
$item->save(); $item->save();
@ -374,7 +374,7 @@ class UserAssetsLogRepository extends BaseRepository
// 计算每个购买当前爆单商品的积分数据 // 计算每个购买当前爆单商品的积分数据
$profit = $productItem['total_price'] - $productItem['cost'] * $productItem['product_num']; $profit = $productItem['total_price'] - $productItem['cost'] * $productItem['product_num'];
$where = array(); $where = array();
$where[] = array('product_id', '=', $productItem['product_id']); // $where[] = array('product_id', '=', $productItem['product_id']);
$list = $hotRepository->getList($where); $list = $hotRepository->getList($where);
$logList = array(); $logList = array();
@ -382,7 +382,7 @@ class UserAssetsLogRepository extends BaseRepository
$tmp = $this->_getIntegral($profit * $product['hot_integral_rate'] / 100 / count($list)); $tmp = $this->_getIntegral($profit * $product['hot_integral_rate'] / 100 / count($list));
if ($item['total'] - $item['current'] < $tmp['integral_buy'] + $tmp['integral_withdraw']) { if ($item['total'] - $item['current'] < $tmp['integral_buy'] + $tmp['integral_withdraw']) {
$tmp = $this->_getIntegral($item['total'] - $item['current']); $tmp = $this->_getIntegral($item['total'] - $item['current']);
$item['status'] = 1; // $item['status'] = 1;
} }
$this->userAssetsRepository->updateAssets($item['uid'], $tmp); $this->userAssetsRepository->updateAssets($item['uid'], $tmp);
$item['current'] += $tmp['integral_buy'] + $tmp['integral_withdraw']; $item['current'] += $tmp['integral_buy'] + $tmp['integral_withdraw'];

@ -62,7 +62,7 @@ class Lottery extends BaseController
{ {
$data = Request::post(); $data = Request::post();
if(count($data) != 8){ if(count($data) != 6){
return app('json')->fail('参数错误'); return app('json')->fail('参数错误');
} }

File diff suppressed because one or more lines are too long

@ -30,14 +30,14 @@ export default{
data(){ data(){
return{ return{
list:[ list:[
], ],
numList:["一","二","三","四","五","六"] numList:["一","二","三","四","五","六"]
} }
}, },
methods:{ methods:{
typeChange(val,item){ typeChange(val,item){
if(val!=1){ if(val!=1){
item.value=0; item.value=0;
} }
@ -49,11 +49,14 @@ export default{
}) })
}, },
submitHandle(){ submitHandle(){
setLotteryData(this.list).then(res=>{ setLotteryData(this.list).then(res=>{
this.getLotteryData() this.getLotteryData()
this.$message({type:'success',message:'保存成功'}); this.$message({type:'success',message:'保存成功'});
}) })
.catch(res => {
this.$message.error(res.message);
})
} }
}, },
mounted(){ mounted(){
@ -63,7 +66,7 @@ export default{
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.prize{ .prize{
background-color: #fff; background-color: #fff;
padding:10px 20px; padding:10px 20px;
} }
@ -93,10 +96,10 @@ export default{
span{ span{
display:inline-block; display:inline-block;
width:50px; width:50px;
margin-left: 20px; margin-left: 20px;
} }
} }
} }
} }
</style> </style>

Loading…
Cancel
Save