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


PHP Framework\M函数代码示例

本文整理汇总了PHP中Lazybug\Framework\M函数的典型用法代码示例。如果您正苦于以下问题:PHP M函数的具体用法?PHP M怎么用?PHP M使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: act

 public function act()
 {
     if (!$this->check_param('userid, username, userrole')) {
         LF\V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用户传递参数错误');
         return;
     }
     $user_id = (int) Request::get_param('userid', 'post');
     $user_name = trim(Request::get_param('username', 'post'));
     $user_password = trim(Request::get_param('userpassword', 'post'));
     if (!preg_match('/^\\w+$/', $user_name)) {
         LF\V('Json.Base')->init(Const_Code::USER_FORMAT_ERROR, '用户名称格式错误');
         return;
     }
     if (LF\M('User')->check_name_update($user_id, $user_name)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_USER_EXISTS, '用户名称重复');
         return;
     }
     if ($user_password) {
         $_POST['userpassword'] = md5($user_name . $user_password);
     } else {
         unset($_POST['userpassword']);
     }
     unset($_POST['username']);
     $result = LF\M('User')->where('id=' . $user_id)->update();
     if (is_null($result)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_USER_FAIL, '用户更新失败');
         return;
     }
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '用户更新成功');
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:30,代码来源:update.php

示例2: act

 public function act()
 {
     $page = (int) Request::get_param('page', 'post');
     $size = (int) Request::get_param('size', 'post');
     $history_size = (int) Request::get_param('historysize', 'post');
     if ($page < 1) {
         $page = 1;
     }
     if ($size < 1) {
         $size = 20;
     }
     if ($history_size) {
         $history_size = 3;
     }
     $task_list = LF\M('Task')->get_all($page, $size, $history_size);
     foreach ($task_list as &$task) {
         $package = LF\M('Package')->get_by_id((int) $task['package_id']);
         $task['packagename'] = $package['name'];
         $space = LF\M('Space')->get_by_id((int) $task['space_id']);
         $task['spacename'] = $space['name'];
         $job = LF\M('Job')->get_by_task((int) $task['id']);
         $task['running'] = $job ? 1 : 0;
         $task['total'] = $job ? (int) $job['total'] : 0;
         $task['current'] = $job ? (int) $job['current'] : 0;
         $task['history'] = LF\M('History')->get_by_task((int) $task['id'], 1, $history_size);
     }
     echo json_encode($task_list);
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:28,代码来源:list.php

示例3: act

 public function act()
 {
     $space_list = LF\M('Space')->get_all();
     $view = LF\V('Html.Space.Index');
     $view->add_data('space_list', $space_list);
     $view->init('Space.Index');
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:7,代码来源:index.php

示例4: act

 public function act()
 {
     $history_id = (int) Request::get_param('id', 'post');
     $host = trim(Request::get_param('host', 'post'));
     $system_info = LF\M('System')->select()->fetch();
     $history_info = LF\M('History')->get_by_id($history_id);
     $pass_num = (int) $history_info['pass'];
     $fail_num = (int) $history_info['fail'];
     $title = '接口自动化测试报告 (' . date('Y-m-d h:i:s') . ')';
     $result = $fail_num === 0 ? '<span style="color:#629731">PASS</span>' : '<span style="color:#d0636e">FAIL</span>';
     $content = '<p style="font-size:20px;font-family:Microsoft Yahei, SimHei, Arial;font-weight:bold;">任务结果: ' . $result . '</p>';
     $content .= '<p style="font-size:16px;font-family:Microsoft Yahei, SimHei, Arial;">总共执行' . ($pass_num + $fail_num) . '个检查点,';
     $content .= '通过<span style="color:#629731;font-weight:bold;">' . $pass_num . '</span>,';
     $content .= '失败<span style="color:#d0636e;font-weight:bold;">' . $fail_num . '</span></p>';
     $content .= '<p style="font-size:16px;font-family:Microsoft Yahei, SimHei, Arial;font-weight:bold;"><a stype="color:#22aabe;" href="' . $host . '/report?id=' . $history_id . '" target="_blank">查看详细报告 >></a></p>';
     foreach (explode(',', $system_info['mail_list']) as $mail) {
         $mail = trim($mail);
         if (!$mail) {
             continue;
         }
         try {
             $smtp = new Extension_Smtp();
             $smtp->setServer($system_info['smtp_server'], $system_info['smtp_user'], $system_info['smtp_password'], $system_info['smtp_port'], $system_info['smtp_ssl'] ? TRUE : FALSE);
             $smtp->setFrom($system_info['smtp_user']);
             $smtp->setReceiver($mail);
             $smtp->setMail($title, $content);
             $smtp->sendMail();
         } catch (Exception $e) {
         }
     }
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:31,代码来源:notice.php

示例5: act

 public function act()
 {
     if (!$this->check_param('username, password, issave')) {
         LF\V('Json.Base')->init(Const_Code::LOGIN_PARAM_ERROR, '登录传递参数错误');
         return;
     }
     $username = trim(Request::get_param('username', 'post'));
     $password = trim(Request::get_param('password', 'post'));
     $is_save = (int) Request::get_param('issave', 'post');
     $time = time();
     $seckey = LF\lb_read_system('seckey');
     $user_id = (int) LF\M('User')->check_password($username, md5($username . $password));
     if (!$user_id) {
         LF\V('Json.Base')->init(Const_Code::LOGIN_FAIL, '帐号验证失败');
         return;
     }
     $user = LF\M('User')->get_by_id($user_id);
     $expire_time = $is_save ? 86400 * 30 : 0;
     Cookie::set_cookie('userid', $user_id, $expire_time);
     Cookie::set_cookie('username', $user['name'], $expire_time);
     Cookie::set_cookie('userrole', $user['role'], $expire_time);
     Cookie::set_cookie('time', $time, $expire_time);
     Cookie::set_cookie('secstr', md5($user_id . '$' . $user['name'] . '$' . $user['role'] . '$' . $time . '$' . $seckey), $expire_time);
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '帐号验证通过');
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:25,代码来源:login.php

示例6: act

 public function act()
 {
     if (!$this->check_param('oldpassword, newpassword')) {
         LF\V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用户传递参数错误');
         return;
     }
     $old_password = trim(Request::get_param('oldpassword', 'post'));
     $new_password = trim(Request::get_param('newpassword', 'post'));
     $user_id = (int) $_COOKIE['userid'];
     $user_name = $_COOKIE['username'];
     $old_password = md5($user_name . $old_password);
     $new_password = md5($user_name . $new_password);
     $user = LF\M('User')->get_by_id($user_id);
     if ($old_password !== $user['passwd']) {
         LF\V('Json.Base')->init(Const_Code::USER_CHECK_ERROR, '用户密码校验失败');
         return;
     }
     $_POST['userpassword'] = $new_password;
     $result = LF\M('User')->where('id=' . $user_id)->update();
     if (is_null($result)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_USER_FAIL, '用户密码更新失败');
         return;
     }
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '用户密码更新成功');
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:25,代码来源:password.php

示例7: act

 public function act()
 {
     if (!$this->check_param('itemid, moduleid, spaceid, casename, sendtype, contenttype')) {
         LF\V('Json.Base')->init(Const_Code::CASE_PARAM_ERROR, '用例传递参数错误');
         return;
     }
     $item_id = (int) Request::get_param('itemid', 'post');
     $case_name = trim(Request::get_param('casename', 'post'));
     if (LF\M('Case')->check_name_exists($item_id, $case_name)) {
         LF\V('Json.Base')->init(Const_Code::ADD_CASE_EXISTS, '用例名称重复');
         return;
     }
     LF\M('Case')->insert();
     $case = LF\M('Case')->get_by_name($item_id, $case_name);
     $case_id = (int) $case['id'];
     if (!$case_id) {
         LF\V('Json.Base')->init(Const_Code::ADD_CASE_FAIL, '用例添加失败');
         return;
     }
     $item = LF\M('Item')->get_by_id($item_id);
     $_POST['caseid'] = $case_id;
     $_POST['stepname'] = '调用: ' . $item['name'] . '->' . $case_name;
     $_POST['steptype'] = '接口调用';
     $_POST['stepcommand'] = 'self';
     $_POST['stepvalue'] = $case_id;
     $_POST['stepsequence'] = 1;
     LF\M('Step')->insert();
     LF\V('Json.Base')->init(Const_Code::SUCCESS, $case_id);
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:29,代码来源:add.php

示例8: act

 public function act()
 {
     $history_id = (int) Request::get_param('historyid', 'post');
     $item_id = (int) Request::get_param('itemid', 'post');
     $case_id = (int) Request::get_param('caseid', 'post');
     echo json_encode(LF\M('Result')->get_by_case($history_id, $item_id, $case_id));
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:7,代码来源:step.php

示例9: act

 public function act()
 {
     if (!$this->check_param('guid')) {
         return;
     }
     $guid = trim(Request::get_param('guid', 'post'));
     LF\V('Xml.Base')->init('summary', LF\M('History')->get_by_guid($guid));
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:8,代码来源:summary.php

示例10: set_system_param

 public function set_system_param($subject, $package, $fliter)
 {
     preg_match_all('/\\$\\{param:(\\w+)\\}/', $subject, $matches);
     foreach (array_unique($matches[1]) as $match) {
         $config = LF\M('Conf')->get_by_keyword($package, 'param', $match);
         $config['value'] = isset($config['value']) ? $config['value'] : '[[ 配置不存在 ]]';
         $replacement = $fliter ? str_replace('"', '\\"', $config['value']) : $config['value'];
         $subject = preg_replace('/\\$\\{param:' . $match . '\\}/', $replacement, $subject);
     }
     return $subject;
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:11,代码来源:base.php

示例11: add_result

 private function add_result($content, $addition)
 {
     $temp = (int) Request::get_param('temp', 'post');
     if ($temp) {
         return;
     }
     $_POST['stepid'] = 1;
     $_POST['steptype'] = '存储查询';
     $_POST['resultcontent'] = $content;
     $_POST['resultvalue1'] = $addition['query'];
     LF\M('Result')->insert();
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:12,代码来源:store.php

示例12: act

 public function act()
 {
     $task_id = (int) Request::get_param('taskid', 'post');
     $space_id = (int) Request::get_param('spaceid', 'post');
     $module_id = (int) Request::get_param('moduleid', 'post');
     if ($module_id) {
         $item_list = LF\M('Item')->get_by_module($module_id, 0, 0);
     } else {
         $item_list = LF\M('Item')->get_by_space($space_id, 0, 0);
     }
     LF\M('Job')->set_total($task_id, count($item_list));
     LF\V('Xml.Base')->init('item', $item_list);
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:13,代码来源:item.php

示例13: act

 public function act()
 {
     if (!$this->check_param('smtpserver, smtpport')) {
         LF\V('Json.Base')->init(Const_Code::SYSTEM_PARAM_ERROR, '系统传递参数错误');
         return;
     }
     $result = LF\M('System')->update();
     if (is_null($result)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_SYSTEM_FAIL, '系统更新失败');
         return;
     }
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '系统更新成功');
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:13,代码来源:mail.php

示例14: act

 public function act()
 {
     $space_id = (int) Request::get_param('spaceid', 'post');
     $module_id = (int) Request::get_param('moduleid', 'post');
     if ($module_id) {
         $item_num = LF\M('Item')->get_count_by_module($module_id);
         $case_num = LF\M('Case')->get_count_by_module($module_id);
     } else {
         $item_num = LF\M('Item')->get_count_by_space($space_id);
         $case_num = LF\M('Case')->get_count_by_space($space_id);
     }
     echo json_encode(array('item_num' => $item_num, 'case_num' => $case_num));
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:13,代码来源:count.php

示例15: add_job

 private function add_job($task_id)
 {
     if (LF\M('Job')->check_task_exists($task_id)) {
         return;
     }
     $_POST['taskid'] = $task_id;
     LF\M('Job')->insert();
     $job = LF\M('Job')->get_by_task($task_id);
     if (!$job) {
         return;
     }
     LF\M('Task')->set_date($task_id);
 }
开发者ID:hanviseas,项目名称:lazybug-for-api,代码行数:13,代码来源:list.php


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