/** * 动画模板的修改意见编辑 */ 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 store(Request $request) { $data = $this->getData($request); $data['created_at'] = time(); UserVoiceModel::create($data); //成功发布后给用户随机奖励金币1-5个 $gold = rand(1, 5); UserGoldModel::setGold($this->userid, 3, $gold); //计算金币总数 if ($gold) { WalletModel::setGold($this->userid, $gold); } return redirect(DOMAIN . 'uservoice'); }
/** * 设置评价、返利 */ 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 setStatus(Request $request, $id) { if ($request->status == 3 && !$request->remarks) { echo "<script>alert('请填写不满意缘由!');history.go(-1);</script>"; exit; } $data = ['status' => $request->status, 'remarks' => $request->remarks, 'updated_at' => time()]; OpinionModel::where('id', $id)->update($data); //成功发布后给用户随机奖励金币10-15个 if ($request->status == 4) { $data['gold2'] = rand(10, 15); UserGoldModel::setGold($this->userid, 2, $data['gold2']); } //计算金币总数 if (isset($data['gold2'])) { WalletModel::setGold($this->userid, $data['gold2']); } return redirect(DOMAIN . 'opinion'); }
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 query() { $datas = WalletModel::orderBy('id', 'desc')->paginate($this->limit); $datas->limit = $this->limit; $datas->signByWeal = $this->signByWeal; $datas->goldByWeal = $this->goldByWeal; $datas->tipByWeal = $this->tipByWeal; return $datas; }