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


PHP Model::execute方法代码示例

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


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

示例1: createForm

 public function createForm($course_id)
 {
     $create_table = new Model();
     /*新建表*/
     $check_name_table = "check_name_" . $course_id;
     $str = "create table {$check_name_table}(\n                student_id VARCHAR (32) NOT NULL ,\n                student_name VARCHAR (32) ,\n                attend_stage VARCHAR (32) ,\n                primary key(student_id)\n                )ENGINE=InnoDB DEFAULT CHARSET=utf8 ";
     $create_table->execute($str);
     /*把之前原始数据插入表中*/
     $select_course = $course_id . "_course";
     $student_string = $create_table->query("select {$select_course} from course_student ");
     $student_string = $student_string[0][$select_course];
     $student_id_sum = explode(',', $student_string);
     /*先把部分学生信息插入表中*/
     for ($index = 0; $index < count($student_id_sum); $index++) {
         $student_id = $student_id_sum[$index];
         $student_name = $create_table->query("select student_name from student_information where student_id='{$student_id}' ");
         $student_name = $student_name[0]['student_name'];
         $create_table->execute("insert into {$check_name_table} VALUES('{$student_id}','{$student_name}','absent')");
     }
 }
开发者ID:Beanson,项目名称:fun,代码行数:20,代码来源:CheckNameModel.class.php

示例2: saveUser

 public function saveUser()
 {
     $data = null;
     $name = $_POST['name'];
     $truename = $_POST['truename'];
     $deptId = $_POST['deptId'];
     $adminFlag = $_POST['adminFlag'];
     $delFlag = $_POST['delFlag'];
     $model = new Model();
     if ($_POST['addFlag'] == 1) {
         //insert
         $sql = "insert into user (name,truename,pwd,dept_id,admin_flag,del_flag) values('" . $name . "','" . $truename . "',md5(123456),'" . $deptId . "','" . $adminFlag . "','" . $delFlag . "')";
         $model->execute($sql);
     } else {
         //update
         $sql = "update user set name = '" . $name . "'\n\t\t\t,truename = '" . $truename . "'\n\t\t\t,dept_id = '" . $deptId . "'\n\t\t\t,admin_flag = '" . $adminFlag . "'\n\t\t\t,del_flag = '" . $delFlag . "'\n\t\t\twhere uid = '" . $_POST['uid'] . "'\n\t\t\t";
         $model->execute($sql);
     }
     $userTreeHtml = $this->createUserTree();
     $data["userTree"] = $userTreeHtml;
     $data["status"] = 1;
     $this->ajaxReturn($data, 'JSON');
 }
开发者ID:jagbir12,项目名称:ABC,代码行数:23,代码来源:UserController.class.php

示例3: adminUpdate

 public function adminUpdate()
 {
     if (session('?userid') && session('?usertype') && $_SESSION['usertype'] == 1) {
         //dump($_POST);
         $Form = new Model();
         //$exist = $Form->query('select admin_id from admin_personal where admin_id = "%s"',$_POST['id']);
         $result = $Form->execute('replace into admin_personal (admin_id,admin_pwd,admin_type) 
             values ("%s","%s",%d)', $_POST['id'], $_POST['key1'], $_POST['key3']);
         if ($result) {
             echo 2;
         } else {
             echo -1;
         }
     } else {
         $this->redirect('Index/index');
     }
 }
开发者ID:rubylou,项目名称:lcb,代码行数:17,代码来源:SuperController.class.php

示例4: changePassword

 public function changePassword()
 {
     $status = 1;
     $model = new Model();
     if (md5($_POST['oldpwd']) != $_SESSION['pwd']) {
         $msg = "输入密码不对";
         $status = 0;
     }
     if ($status == 1) {
         //$sql="update user set pwd=".md5($_POST['newpwd1'])." where uid ='".$_SESSION['uid']."'";
         //$model->execute("insert into tmp(col1) values('".$sql."')");
         $model->execute("update user set pwd='" . md5($_POST['newpwd1']) . "' where uid ='" . $_SESSION['uid'] . "'");
     }
     $returnData['status'] = $status;
     $returnData['msg'] = $msg;
     $this->ajaxReturn($returnData, 'JSON');
 }
开发者ID:jagbir12,项目名称:ABC,代码行数:17,代码来源:PublicController.class.php

示例5: index

 public function index()
 {
     //dump($_GET);
     $key1 = $_GET['key1'];
     $key2 = $_GET['key2'];
     $key3 = $_GET['key3'];
     $Form = new Model();
     $r = $Form->query('select * from email_active where user_id = "%s"', $key1);
     //dump($r);
     if ($r) {
         $mesg;
         $record = $r[0];
         //dump($record);
         //dump($record[mail_address]);
         if ($record[mail_address] != $key2) {
             $mesg = "请使用注册邮箱激活!";
             //dump($this->mesg);
         } else {
             if ($record[active_code] != $key3) {
                 $mesg = "激活码错误!";
                 //dump($this->mesg);
             } else {
                 if (intval($record[over_time]) < time()) {
                     $mesg = "激活码过期!";
                     //dump($this->mesg);
                 } else {
                     $res = $Form->execute('update email_active set active_status="1" where user_id="%s"', $key1);
                     if ($res) {
                         //dump($res);
                         $mesg = " 激活成功!";
                         //dump($this->mesg);
                     }
                 }
             }
         }
     } else {
         $mesg = "激活失败!";
     }
     $this->tip = $mesg;
     //dump($this->tip);
     $this->display();
 }
开发者ID:rubylou,项目名称:lcb,代码行数:42,代码来源:ActiveController.class.php

示例6: getMyPlanList

 function getMyPlanList()
 {
     $param = json_decode(file_get_contents('php://input'), true);
     $token = $param['xtoken'];
     init_verify_token($token);
     $uid = $param['uid'];
     //$uid = 1584;
     if (empty($uid)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     $model = new Model();
     //查询是否有过期的,有过期就更新
     $time = time();
     $sql = "UPDATE my_plan SET status=4 WHERE uid={$uid} AND end_time<{$time}";
     $model->execute($sql);
     $sql = "SELECT t.*, user_info.header,user_info.name,user_info.nicker FROM\n            (\n                SELECT DISTINCT pid,title,coverimg,type AS isfree,peoplenumber,coachid,status,begin_time,end_time from my_plan,plan where my_plan.pid = plan.id and uid={$uid} ORDER BY isfree desc\n            ) AS t,user_info \n            WHERE t.coachid=user_info.id";
     $result = $model->query($sql);
     $data['errno'] = 0;
     $data['plan_list'] = $result;
     echo json_encode($data);
 }
开发者ID:kaka2007,项目名称:xplan,代码行数:21,代码来源:PlanController.class.php

示例7: messageDetail

 public function messageDetail()
 {
     if (session('?userid') && session('?usertype') && ($_SESSION['usertype'] == 1 || $_SESSION['usertype'] == 3)) {
         $id = $_GET['key'];
         $Form = new Model();
         $Form->execute("update messagebox set adminread=1 where id='%s'", $id);
         $msg = $Form->query("select * from messagebox where id = '%s'", $id);
         if ($msg) {
             $this->msg = $msg[0];
             $type = $msg[0]['msg_type'];
             if ($type == '1') {
                 $innovator = $Form->query('select user_id,name,email,phone from entrepreneur_personal where user_id="%s"', $msg[0]['from_id']);
                 $this->from = $innovator[0];
                 $this->from_page = U('Home/User/innovator/val/' . $msg[0]['from_id']);
                 $investor = $Form->query('select user_id,name,email,mobile as phone from investor_personal where user_id="%s"', $msg[0]['to_id']);
                 $this->to_page = U('Home/User/investor/val/' . $msg[0]['to_id']);
                 $this->to = $investor[0];
             } else {
                 if ($type == '2') {
                     $innovator = $Form->query('select user_id,name,email,phone from entrepreneur_personal where user_id="%s"', $msg[0]['to_id']);
                     $this->to = $innovator[0];
                     $this->to_page = U('Home/User/innovator/val/' . $msg[0]['to_id']);
                     $investor = $Form->query('select user_id,name,email,mobile as phone from investor_personal where user_id="%s"', $msg[0]['from_id']);
                     $this->from_page = U('Home/User/investor/val/' . $msg[0]['from_id']);
                     $this->from = $investor[0];
                 } else {
                     $innovator = $Form->query('select user_id,name,email,phone from entrepreneur_personal where user_id="%s"', $msg[0]['from_id']);
                     $this->from = $innovator[0];
                     $this->from_page = U('Home/User/innovator/val/' . $msg[0]['from_id']);
                     $innovator = $Form->query('select user_id,name,email,phone from entrepreneur_personal where user_id="%s"', $msg[0]['to_id']);
                     $this->to = $innovator[0];
                     $this->to_page = U('Home/User/innovator/val/' . $msg[0]['to_id']);
                 }
             }
         }
         $this->display();
     } else {
         $this->redirect('Index/index');
     }
 }
开发者ID:rubylou,项目名称:lcb,代码行数:40,代码来源:MessageController.class.php

示例8: docancle

 function docancle()
 {
     //如果该用户没投这个项目,那么他不能投票
     $pid = I('pid');
     $leader_id = I('leader_id');
     $uid = is_login();
     $countP = M('ProjLeader')->where(array('pid' => $pid, 'uid' => $uid))->count();
     if (!$countP) {
         $retData['message'] = "你还没有投资该项目,因此你不能取消!";
         $retData['status'] = false;
     }
     //如果已经对该项目投过票了则不能再投了
     $uid = is_login();
     $touziCount = $this->touziCount($pid, $uid);
     $Projectvote = M('ProjectVote');
     $deleteVote = $Projectvote->where(array('project_id' => $pid, 'investor_id' => $uid))->save(array('marks' => 1));
     $sqlstr = "UPDATE jm_proj_leader SET voit_count=voit_count-" . $touziCount . " WHERE pid=" . $pid . " AND uid=" . $leader_id . " ";
     $model = new Model();
     $update = $model->execute($sqlstr);
     if ($update) {
         $retData['message'] = "取消成功!";
         $retData['status'] = true;
     }
     $jsonstr = json_encode($retData);
     echo $jsonstr;
 }
开发者ID:rainly123,项目名称:zyzm,代码行数:26,代码来源:VoteController.class.php

示例9: import

 public function import()
 {
     if (!IS_AJAX) {
         $this->error(L('_ERROR_ACTION_'));
     }
     if (I('get.file')) {
         $filename = base64_decode(I('get.file'));
         $file = C('BACKUP_PATH') . $filename;
         $sql = read_file($file);
         $db = new Model();
         $res = $db->execute($sql);
         if ($res === FALSE) {
             $this->error(L('IMPORT_ERROR'));
         } else {
             $this->success(L('IMPORT_OK'), U('Database/recover', $this->vl));
         }
     } else {
         $this->error(L('_ERROR_ACTION_'));
     }
 }
开发者ID:925800521,项目名称:itskycms,代码行数:20,代码来源:DatabaseController.class.php

示例10: userSave

 public function userSave()
 {
     $Form = new Model();
     if (I('post.value') === 'investor') {
         $seed = rand(C(RANDOM_USER_MIN), C(RANDOM_USER_MAX));
         $id = '1' . substr(date('Y'), 2) . $seed;
         $regTime = date('Y-m-d');
         $exist = $Form->query('select user_id from investor_personal where user_id = "%s"', $id);
         while ($exist) {
             $seed = rand(C(RANDOM_USER_MIN), C(RANDOM_USER_MAX));
             $id = '1' . substr(date('Y'), 2) . $seed;
             $exist = $Form->query('select user_id from investor_personal where user_id = "%s"', $id);
         }
         $result = $Form->execute('insert into investor_personal 
             (user_id,name,mobile,email,company,title,user_type,reg_time,reg_status)
             values ("%s","%s","%s","%s","%s","%s",%d,
             "%s",%d)', $id, $_POST['key1'], encode($_POST['key2']), encode($_POST['key3']), $_POST['key4'], $_POST['key5'], $_POST['key6'], $regTime, 0);
         //感兴趣领域
         $interests = $_POST['key9'];
         $interests = explode(',', $interests);
         for ($i = 0; $i < count($interests) - 1; $i++) {
             $temp = $Form->execute('replace into interest_investor (id, interest_field) values ("%s",%d)', $id, $interests[$i]);
         }
         //认证资料
         if ($_POST['key6'] == 1) {
             $result1 = $Form->execute('insert into investor_company (user_id, company_name) values ("%s","%s")', $id, $_POST['key4']);
         } else {
             if ($_POST['key6'] == 2) {
                 $result1 = $Form->execute('insert into investor_fi (user_id) values ("%s")', $id);
             }
         }
         if ($result) {
             $safety = $Form->execute('insert into investor_security (user_id,user_pwd) 
                 values ("%s","%s")', $id, $_POST['key7']);
             if ($safety) {
                 echo 200;
             } else {
                 echo 400;
             }
         } else {
             echo 400;
         }
     } else {
         if (I('post.value') === 'innovator') {
             $seed = rand(C(RANDOM_USER_MIN), C(RANDOM_USER_MAX));
             $id = '2' . substr(date('Y'), 2) . $seed;
             $regTime = date('Y-m-d');
             $exist = $Form->query('select user_id from entrepreneur_personal where user_id = "%s"', $id);
             while ($exist) {
                 $seed = rand(C(RANDOM_USER_MIN), C(RANDOM_USER_MAX));
                 $id = '1' . substr(date('Y'), 2) . $seed;
                 $exist = $Form->query('select user_id from entrepreneur_personal where user_id = "%s"', $id);
             }
             $result = $Form->execute('insert into entrepreneur_personal 
             (user_id,name,email,phone,nickname,gender,birthday,city,reg_time,reg_status)
             values ("%s","%s","%s","%s","%s",%d,"%s",%d,
             "%s",%d)', $id, $_POST['key1'], encode($_POST['key2']), encode($_POST['key3']), $_POST['key4'], $_POST['key5'], $_POST['key6'], $_POST['key7'], $regTime, 0);
             //感兴趣领域
             $interests = $_POST['key9'];
             $temp = $Form->execute('replace into interest_entrepreneur (id, interest_field) values ("%s",%d)', $id, $interests);
             if ($result) {
                 $safety = $Form->execute('insert into entrepreneur_security (user_id,user_pwd) 
                 values ("%s","%s")', $id, $_POST['key11']);
                 if ($safety) {
                     echo 200;
                 } else {
                     echo 400;
                 }
             } else {
                 echo 400;
             }
         } else {
             echo 400;
         }
     }
 }
开发者ID:rubylou,项目名称:lcb,代码行数:76,代码来源:IndexController.class.php

示例11: send_find_mail

function send_find_mail($user_id, $objectid, $to_address)
{
    $Form = new Model();
    $name = '';
    $pwd = '';
    $active_code = '';
    if ($objectid == 2) {
        $names = $Form->query('select name from investor_personal where user_id="%s"', $user_id);
        $pwds = $Form->query('select user_pwd from investor_security where user_id="%s"', $user_id);
        $name = $names[0][name];
        $pwd = $pwds[0][user_pwd];
    } else {
        $names = $Form->query('select name from entrepreneur_personal where user_id="%s"', $user_id);
        $pwds = $Form->query('select user_pwd from entrepreneur_security where user_id="%s"', $user_id);
        $name = $names[0][name];
        $pwd = $pwds[0][user_pwd];
    }
    $active_time = time();
    $over_time = $active_time + 24 * 60 * 60;
    $active_code = md5($user_id . $name . $pwd . $active_time);
    $sqlstr = sprintf("replace into email_find_pwd (user_id,active_code,mail_address,over_time,active_status)\n             values ('%s','%s','%s','%d','%d')", $user_id, $active_code, $to_address, $over_time, 0);
    $res = $Form->execute($sqlstr);
    if ($res) {
        $url = sprintf("http://localhost:8888/lcb/index.php/Home/Account/setting?key1=%s&key2=%s&key3=%s", $user_id, $to_address, $active_code);
        $body = sprintf("尊敬的用户 %s:请点击以下链接重置密码,如不能点击请将地址拷贝至浏览器栏。<br><a>%s</a>", $name, $url);
        return think_send_mail($to_address, $name, $subject = '来创科技重置密码', $body);
    }
    return 400;
}
开发者ID:rubylou,项目名称:lcb,代码行数:29,代码来源:function.php

示例12: newAnswer

 public function newAnswer()
 {
     //获取客户端发送的json
     $json = json_decode($GLOBALS['HTTP_RAW_POST_DATA']);
     $key = "access_token";
     $jwt = $json->access_token;
     if ($json->access_token == null) {
         $log = "无access_token";
     } else {
         $jwt = JWT::decode($jwt, $key, array('HS256'));
         $timenow = date("YmdHis", strtotime('now'));
         if (!($jwt->aud == $json->username && $timenow < $jwt->exp && $timenow > $jwt->iat)) {
             $log = "超时或名称不对称";
         }
     }
     $arr = $json;
     $answer = $arr->answer;
     $id = $arr->id;
     $Model = new Model();
     $adate = date("YmdHis", strtotime('now'));
     //创建投票开始的年月日时分秒
     $sql = "select name from " . __PREFIX__ . "user where id=" . $json->username;
     $res = $Model->query($sql);
     $aname = $res[0]['name'];
     $sql = "update " . __PREFIX__ . "qa set aid={$json->username}, aname='{$aname}', answer='{$answer}', adate='{$adate}' where id=" . $id;
     /*  echo $sql;
         die; */
     if ($Model->execute($sql)) {
         $suc = 1;
     } else {
         $suc = 0;
     }
     $resjson = json_encode($res);
     $jsonsend = array("username" => $json->username, "suc" => $suc, "access_token" => $json->access_token);
     /**
      * IMPORTANT:
      * You must specify supported algorithms for your application. See
      * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
      * for a list of spec-compliant algorithms.
      */
     $json = json_encode($jsonsend);
     //echo $json;
     echo $json;
     // $this->display("./Background/Home/phyman-1/index.html");
     // $this->assign($json);
 }
开发者ID:ivyhappy,项目名称:PHYMAN,代码行数:46,代码来源:QaController.class.php

示例13: requestAuth

 public function requestAuth()
 {
     //dump($_POST);
     $Form = new Model();
     $id = I('post.p', 0);
     $result = $Form->execute('update project_info set status = 1 where project_id = "%s"', $id);
     if ($result) {
         echo 200;
     } else {
         echo 400;
     }
 }
开发者ID:rubylou,项目名称:lcb,代码行数:12,代码来源:CaseController.class.php

示例14: saveIntro

 public function saveIntro()
 {
     if (session('?userid') && session('?usertype') && ($_SESSION['usertype'] == 1 || $_SESSION['usertype'] == 3)) {
         $Form = new Model();
         if (count($_POST['c']) > 0 && count($_POST['p']) > 0) {
             $result = $Form->execute('update project_info set project_intro="%s" where project_id="%s"', $_POST['c'], $_POST['p']);
             if ($result) {
                 echo 200;
             } else {
                 echo 400;
             }
         }
     }
 }
开发者ID:rubylou,项目名称:lcb,代码行数:14,代码来源:AuditController.class.php

示例15: testDelete

    public function testDelete()
    {
        $config = $this->getConfig();
        $order_model = new Model('order', $config);
        $order_model->id = 2;
        $flag = $order_model->delete();
        $this->assertEquals(1, $flag);
        $flag = $order_model->delete('1');
        $this->assertEquals(1, $flag);
        $address_model = new Model('user_address', $config);
        $flag = $address_model->delete(['1', '2']);
        $this->assertEquals(2, $flag);
        $user_model = new Model('user', $config);
        $flag = $user_model->using([''])->where('1=1')->delete();
        $this->assertEquals(2, $flag);
        $ru_model = new Model('role_user', $config);
        $flag = $ru_model->delete(['1', '1']);
        $this->assertEquals(1, $flag);
        $sql = <<<EOF
DROP TABLE IF EXISTS `tp_user`;
DROP TABLE IF EXISTS `tp_order`;
DROP TABLE IF EXISTS `tp_user_address`;
DROP TABLE IF EXISTS `tp_role_user`;
EOF;
        $model = new Model('', $this->getConfig());
        $model->execute($sql);
        $flag = $model->db(0, null);
        $this->assertNull($flag);
    }
开发者ID:cnzin,项目名称:think,代码行数:29,代码来源:modelTest.php


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