本文整理匯總了PHP中Lazybug\Framework\V函數的典型用法代碼示例。如果您正苦於以下問題:PHP V函數的具體用法?PHP V怎麽用?PHP V使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了V函數的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
示例2: act
public function act()
{
$user_num = LF\M('User')->get_count();
$view = LF\V('Html.User.Index');
$view->add_data('page_num', ceil((int) $user_num['count'] / 10));
$view->init('User.Index');
}
示例3: 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, '帳號驗證通過');
}
示例4: 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, '用戶更新成功');
}
示例5: 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, '用戶密碼更新成功');
}
示例6: check_api_auth
public function check_api_auth()
{
if (!$this->check_auth()) {
LF\V('Json.Base')->init(Const_Code::AUTH, '授權限製');
exit;
}
}
示例7: 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));
}
示例8: act
public function act()
{
$case_id = (int) Request::get_param('caseid', 'post');
$case = LF\M('Case')->get_by_id($case_id);
if (!$case) {
LF\V('Xml.Base')->init('step', array());
return;
}
$_POST['resultname'] = $case['name'];
LF\M('Result')->insert();
LF\V('Xml.Base')->init('step', LF\M('Step')->get_by_case($case_id));
}
示例9: 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);
}
示例10: 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, '係統更新成功');
}
示例11: act
public function act()
{
if (!$this->check_param('caseid')) {
LF\V('Json.Base')->init(Const_Code::CASE_PARAM_ERROR, '用例傳遞參數錯誤');
return;
}
$case_id = (int) Request::get_param('caseid', 'post');
LF\M('Case')->remove($case_id);
$case = LF\M('Case')->get_by_id($case_id);
if ($case) {
LF\V('Json.Base')->init(Const_Code::DELETE_CASE_FAIL, '用例刪除失敗');
return;
}
LF\V('Json.Base')->init(Const_Code::SUCCESS, '用例刪除成功');
}
示例12: act
public function act()
{
if (!$this->check_param('taskid, taskhang')) {
LF\V('Json.Base')->init(Const_Code::TASK_PARAM_ERROR, '任務傳遞參數錯誤');
return;
}
$task_id = (int) Request::get_param('taskid', 'post');
$task_hang = (int) Request::get_param('taskhang', 'post');
$result = LF\M('Task')->set_hang($task_id, $task_hang);
if (is_null($result)) {
LF\V('Json.Base')->init(Const_Code::UPDATE_TASK_FAIL, '任務更新失敗');
return;
}
LF\V('Json.Base')->init(Const_Code::SUCCESS, '任務更新成功');
}
示例13: act
public function act()
{
try {
$user = LF\M('User');
} catch (Exception $e) {
Response::set_header_location('/index.php/database');
exit;
}
if (!function_exists('curl_init')) {
Response::set_header_location('/index.php/module?name=php-curl');
exit;
}
$view = LF\V('Html.Public.Login');
$view->init('Public.Login');
}
示例14: act
public function act()
{
$item_id = (int) Request::get_param('itemid', 'post');
$task_id = (int) Request::get_param('taskid', 'post');
$level = (int) Request::get_param('level', 'post');
LF\M('Job')->increase_current($task_id);
$item = LF\M('Item')->get_by_id($item_id);
if (!$item) {
LF\V('Xml.Base')->init('case', array());
return;
}
$_POST['resultname'] = $item['name'];
LF\M('Result')->insert();
LF\V('Xml.Base')->init('case', LF\M('Case')->get_by_level($item_id, $level));
}