Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function data(Request $request)
 {
     $activity_type = new ActivityType();
     $builder = $activity_type->newQuery()->orderBy('id', 'asc');
     $_builder = clone $builder;
     $total = $_builder->count();
     unset($_builder);
     $data = $this->_getData($request, $builder);
     $data['recordsTotal'] = $total;
     $data['recordsFiltered'] = $data['total'];
     return $this->success('', FALSE, $data);
 }
Пример #2
0
 public function activity_product()
 {
     if (!empty($this->activity_type)) {
         $activity = Activity::find($this->activity_type);
         if (!empty($activity) && $activity->start_date <= date("Y-m-d H:i:s") && $activity->end_date >= date("Y-m-d H:i:s") && $activity->status == 1) {
             $class_dir = ActivityType::find($activity->type_id)->class_dir;
             $config = json_decode($activity->argc, true);
         } else {
             return $this;
         }
     } else {
         return $this;
     }
     return with(new $class_dir())->config($config)->product_decorate($this);
 }
Пример #3
0
 public function activity_bonus($uid)
 {
     $activity_type = Product::find($this->pid)->activity_type;
     if (!empty($activity_type)) {
         $activity = Activity::find($activity_type);
         if (!empty($activity) && $activity->start_date <= date("Y-m-d H:i:s") && $activity->end_date >= date("Y-m-d H:i:s") && $activity->status == 1) {
             $class_dir = ActivityType::find($activity->type_id)->class_dir;
             $config = json_decode($activity->argc, true);
         } else {
             return '';
         }
     } else {
         return '';
     }
     $bonus_config = ['fid' => Product::find($this->pid)->fid, 'uid' => $uid, 'aid' => $activity_type];
     return with(new $class_dir())->config($config)->bonus($bonus_config);
 }
Пример #4
0
 public function getTypeHtml(Request $request)
 {
     $id = $request->get('id');
     $type_id = $request->get('type_id');
     if ($type_id) {
         $argc = Activity::find($id)->argc;
         $class_dir = ActivityType::find($type_id)->class_dir;
         $html = with(new $class_dir())->show_edit_html($argc);
     } else {
         $html = '';
     }
     exit($html);
 }
Пример #5
0
 public function destroy(Request $request, $id)
 {
     empty($id) && !empty($request->input('id')) && ($id = $request->input('id'));
     $id = (array) $id;
     foreach ($id as $v) {
         $activity_type = ActivityType::destroy($v);
     }
     return $this->success('', count($id) > 5, compact('id'));
 }