示例#1
0
 public function editAction()
 {
     $data = I("data");
     $data = htmlspecialchars_decode($data);
     $data = json_decode($data, true);
     $model = D("ClubSchedule");
     $now = date('Y-m-d H:i:s');
     $valid_data = array();
     foreach ($data as $key => $value) {
         $start = date('Y-m-d H:i:s', strtotime($value['start']));
         if ($start < $now) {
             continue;
         }
         $end = date('Y-m-d H:i:s', strtotime($value['end']));
         $value['start'] = $start;
         $value['end'] = $end;
         $valid_data[] = $value;
     }
     $start = date('Y-m-d H:i:s', strtotime(I('start')));
     $end = date('Y-m-d H:i:s', strtotime(I('end')));
     if ($start < $now) {
         $start = $now;
     }
     $club_id = get_club_id();
     $model->where(array("club_id" => $club_id, "start" => array("between", array($start, $end))))->delete();
     $valid_data = array_unique_2d($valid_data);
     foreach ($valid_data as $key => $value) {
         if (!$model->create($value)) {
             $this->error($model->getError());
         }
         $id = $model->add();
     }
     $this->ajaxReturn(array("status" => 1, "info" => "修改成功!"));
 }
示例#2
0
 public function infoAction()
 {
     $openid = I("openid");
     if (empty($openid)) {
         $this->ajaxReturn(array("status" => 0, "info" => "openid is empty"));
     }
     $arr = M("WeixinBind")->where(array("weixin_code" => $openid))->field("group_concat(member_id) as uids")->find();
     $rsp = array();
     if (!empty($arr) && !empty($arr['uids'])) {
         $uids = $arr['uids'];
         $uids = explode(",", $uids);
         foreach ($uids as $key => $value) {
             $clubs = D("CardUseclub")->getCanUseClubs($value);
             $rsp = array_merge($rsp, $clubs);
         }
         $rsp = array_unique_2d($rsp);
         // $members=M("MemberBasic")->where(array("id"=>array("in",$uids)))->order("id desc")->limit(20)->select();
         // if(!empty($members))
         // {
         //    $member=$members[0];
         //    $sys_protocal = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://';
         //    $member['avatar'] = $sys_protocal.$_SERVER['HTTP_HOST']. "/Public/uploads/mmb_avatar/".$member['avatar'];
         // }
         // else
         // {
         //  $member=array();
         // }
         // $clubs = array();
         // foreach ($members as $key => $value) {
         //    $club_id=$value['club_id'];
         //    $club=M("Club")->find($club_id);
         //    $club['uid']=$value['id'];
         //    $clubs[]=$club;
         // }
         // $member['clubs']=$clubs;
     }
     $this->ajaxReturn(array("status" => 1, "data" => $rsp));
 }