当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::max方法代码示例

本文整理汇总了PHP中think\Model::max方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::max方法的具体用法?PHP Model::max怎么用?PHP Model::max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在think\Model的用法示例。


在下文中一共展示了Model::max方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addManyDayCourse

 function addManyDayCourse()
 {
     header('Access-Control-Allow-Origin:*');
     //跨域
     header("Content-type: text/html; charset=utf-8");
     $param = json_decode(file_get_contents('php://input'), true);
     /*   $str = '{
         "xtoken":"35dsakfsdjfcvjdsajfkdsf234",
         "coachid":45,
         "uid":999,
         "pid":41,
         "course_list":[
         {
             "course_time":32435435,
             "action_list":[
             {
                 "actionid":177,
                 "group":3,
                 "count":20,
                 "order":1,
                 "type":1,
                 "duration":34
             },
             {   
                 "actionid":188,
                 "group":3,
                 "count":20,
                 "order":1,
                 "type":2,
                 "duration":54
             }]
         },
         {
             "course_time":32438935,
             "action_list":[
             {
                 "actionid":199,
                 "group":3,
                 "count":20,
                 "order":1,
                 "type":1,
                 "duration":34
             },
             {   
                 "actionid":166,
                 "group":3,
                 "count":20,
                 "order":1,
                 "type":2,
                 "duration":54
             }]
         }]
     }';*/
     // $param = json_decode($str,true);
     $token = $param['xtoken'];
     init_verify_token($token);
     $uid = $param['uid'];
     $pid = $param['pid'];
     $coachid = $param['coachid'];
     if (!isset($uid) || !isset($pid) || !isset($coachid)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     $course_list = $param['course_list'];
     //找到开始时间和结束时间
     $begin_time = $course_list[0]['course_time'];
     $end_time = $course_list[0]['course_time'];
     for ($i = 0; $i < count($course_list); $i++) {
         if ($course_list[$i]['course_time'] <= $begin_time) {
             $begin_time = $course_list[$i]['course_time'];
         }
         if ($course_list[$i]['course_time'] >= $end_time) {
             $end_time = $course_list[$i]['course_time'];
         }
     }
     //课程id
     $model_course_record = new Model('course_record');
     $cur_courseid = $model_course_record->max('courseid') + 1;
     //获取 pay_time
     $model_my_plan = new Model('my_plan');
     $condition['uid'] = $uid;
     $condition['pid'] = $pid;
     $condition['coachid'] = $coachid;
     $condition['courseid'] = 0;
     $result_pay_time = $model_my_plan->select();
     $pay_time = $result_pay_time[0]['pay_time'];
     $model_my_plan->where($condition)->delete();
     //删除记录为courseid=0的
     for ($i = 0; $i < count($course_list); $i++) {
         //添加课程记录
         $action_list = $course_list[$i]['action_list'];
         for ($j = 0; $j < count($action_list); $j++) {
             $action_list[$j]['courseid'] = $cur_courseid;
             $model_course_record->add($action_list[$j]);
         }
         //把相应的课程记录添加到my_plan
         unset($data_my_plan);
         $data_my_plan['uid'] = $uid;
         $data_my_plan['pid'] = $pid;
         $data_my_plan['coachid'] = $coachid;
         $data_my_plan['courseid'] = $cur_courseid;
//.........这里部分代码省略.........
开发者ID:kaka2007,项目名称:xplan,代码行数:101,代码来源:CourseController.class.php


注:本文中的think\Model::max方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。