/** * 动画模板的修改意见编辑 */ public function editLayer($id) { $data = ProductModel::find($id); $wallet = WalletModel::where('uid', $this->userid)->first(); $result = ['video' => $data->getVideo(), 'videoName' => $data->name, 'data' => $data, 'orderProModel' => $this->orderProModel, 'wallet' => $wallet]; return view('home.creation.editLayer', $result); }
/** * 设置评价、返利 */ public function setComment($id, $comment, $backGold) { if ($comment == 0) { $status = 6; } elseif ($comment == 1) { $status = 7; } OrderProductModel::where('id', $id)->where('status', 5)->update(['status' => $status]); //金币返利 if ($comment && $backGold) { UserGoldModel::setGold($this->userid, 4, $backGold); WalletModel::where('uid', $this->userid)->increment('gold', $backGold); } return redirect(DOMAIN . 'member/orderpro'); }
public function add($day) { if ($this->getDaySign()) { echo "<script>alert('今天已经签到过了!');history.go(-1);</script>"; exit; } if (ltrim(date('d', time()), '0') != $day) { echo "<script>alert('点击的不是今天签到日期!');history.go(-1);</script>"; exit; } $reward = rand(1, 10); $data = ['uid' => $this->userid, 'reward' => $reward, 'created_at' => time()]; UserSignModel::create($data); //奖励加入总数 $userParam = WalletModel::where('uid', $this->userid)->first(); WalletModel::where('id', $userParam->id)->update(['sign' => $userParam->sign + $reward]); return redirect(DOMAIN . 'person/sign'); }
public function query() { if (!WalletModel::where('uid', $this->userid)->first()) { $data = ['uid' => $this->userid, 'weal' => 200, 'created_at' => time()]; WalletModel::create($data); } $data1 = WalletModel::where('uid', $this->userid)->first(); $data1->signByWeal = $this->signByWeal; $data1->goldByWeal = $this->goldByWeal; $data1->tipByWeal = $this->tipByWeal; return $data1; }
/** * 设置好评的返金币 */ public function setBackGold($id, $uid) { OrderProductModel::where('id', $id)->update(['status' => 8]); //更新基本数量 UserGoldModel::setGold($uid, 4, 5); $walletModel = WalletModel::where('uid', $uid)->first(); WalletModel::where('uid', $uid)->update(['gold' => $walletModel->gold + 5]); return redirect(DOMAIN . 'admin/orderpro'); }
/** * 兑换更新福利 */ public function setWeal(Request $request, $id) { if (!$request->num) { echo "<script>alert('数量必填!');history.go(-1);</script>"; exit; } $wallet = WalletModel::find($id); if ($request->type == 1) { $signCount = $request->num * $this->signByWeal; $data = ['sign' => $wallet->sign - $signCount, 'weal' => $wallet->weal + $request->num]; } else { if ($request->type == 2) { $goldCount = $request->num * $this->goldByWeal; $data = ['gold' => $wallet->gold - $goldCount, 'weal' => $wallet->weal + $request->num]; } else { if ($request->type == 3) { $tipCount = $request->num * $this->tipByWeal; $data = ['tip' => $wallet->tip - $tipCount, 'weal' => $wallet->weal + $request->num]; } } } WalletModel::where('id', $id)->update($data); return redirect(DOMAIN . 'admin/wallet'); }