public function articleIndex(Request $request)
 {
     $customer = \Helper::getCustomerOrNull();
     if (!$customer) {
         if (!$customer->articleIndexNeedFeedBack()) {
             \Log::info('hongbao---111');
         } else {
             \Log::info('hongbao---222');
         }
     } else {
         \Log::info('hongbao---333');
     }
     if (!$customer || !$customer->articleIndexNeedFeedBack()) {
         \Log::info('hongbao---不存在');
         \Analyzer::updateBasicStatistics($customer->id, AnalyzerConstant::CUSTOMER_ARTICLE);
         return redirect("http://mp.weixin.qq.com/mp/homepage?__biz=MzI4NTAxMzc3Mw==&hid=1&sn=740141c97f60c8630a87a3f0c344a504#wechat_redirect");
     } else {
         \Log::info('hongbao---存在');
         $count = $customer->readArticleIndex();
         \BeanRecharger::executeEducation($customer);
         \Analyzer::updateBasicStatistics($customer->id, AnalyzerConstant::CUSTOMER_ARTICLE);
         return view('education.hongbao')->with(['redirect_url' => "http://mp.weixin.qq.com/mp/homepage?__biz=MzI4NTAxMzc3Mw==&hid=1&sn=740141c97f60c8630a87a3f0c344a504#wechat_redirect", 'count' => $count]);
     }
 }
 public function updateBean(Request $request)
 {
     $customer = \Helper::getCustomer();
     if (!$customer) {
         return response()->json(['result' => '-1']);
     }
     /*if>*/
     if (!$customer->is_registered) {
         return response()->json(['result' => '-1']);
     }
     /*if>*/
     $article = Article::where('id', $request->input('id'))->first();
     \Analyzer::updateArticleStatistics($customer->id, $article->type_id);
     \Analyzer::updateBasicStatistics($customer->id, AnalyzerConstant::CUSTOMER_ARTICLE);
     \EnterpriseAnalyzer::updateArticleStatistics($article->type_id);
     \EnterpriseAnalyzer::updateBasic(AnalyzerConstant::ENTERPRISE_ARTICLE);
     if (\DailyAnalyzer::getDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE)) {
         \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE);
         return response()->json(['result' => '-1']);
     }
     \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE);
     \BeanRecharger::executeEducation($customer);
     return response()->json(['result' => '1']);
 }
Example #3
0
 /**
  * @return $this
  */
 public function calculate()
 {
     $cash_payment_calculated_without_post_fee = \BeanRecharger::calculateConsume($this->customer, $this->total_price - $this->post_fee - $this->min_cash_price_without_post_fee);
     $this->cash_payment_calculated = $cash_payment_calculated_without_post_fee + $this->post_fee + $this->min_cash_price_without_post_fee;
     $this->beans_payment_calculated = $this->total_price - $cash_payment_calculated_without_post_fee - $this->post_fee - $this->min_cash_price_without_post_fee;
     return $this;
 }
Example #4
0
 /**
  * @param $amount
  */
 public function buyCards($amount)
 {
     \BeanRecharger::executeTransferCash($this, $amount * 10000);
 }