本文整理汇总了PHP中UserModel::field方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::field方法的具体用法?PHP UserModel::field怎么用?PHP UserModel::field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetUserByPhoneAndDeleteUserById
public function testGetUserByPhoneAndDeleteUserById()
{
$table = new UserModel();
$ret = $table->getUserByPhone('333333');
$this->assertTrue($ret['nickname'] == '王五');
$beforeTotal = $table->field('COUNT(*) as total')->find();
$table->deleteById($ret['id']);
$afterTotal = $table->field('COUNT(*) as total')->find();
$this->assertTrue(1 == $beforeTotal['total'] - $afterTotal['total']);
}
示例2: indexAction
public function indexAction()
{
$p = $_REQUEST;
$pPhone = empty($p['phone']) ? '' : trim($p['phone']);
$pNewptxt = empty($p['newptxt']) ? '' : trim($p['newptxt']);
$pCode = empty($p['code']) ? '' : intval(trim($p['code']));
$tTime = time();
if (empty($pPhone)) {
Tool_Fnc::ajaxMsg('请输入手机号码');
}
if (empty($pNewptxt)) {
Tool_Fnc::ajaxMsg('请输入新密码');
}
if (!Tool_Validate::mo($pPhone)) {
Tool_Fnc::ajaxMsg('手机号不正确');
}
$tMO = new UserModel();
$tRow = $tMO->field('*')->where('phone = \'' . $pPhone . '\'')->fRow();
if (empty($tRow['id'])) {
Tool_Fnc::ajaxMsg('用户不存在');
}
$tCodeMO = new PhonecodeModel();
$tCodeCRow = $tCodeMO->check($pPhone, 2, $pCode);
if ($tCodeCRow['status'] == 0) {
Tool_Fnc::ajaxMsg($tCodeCRow['msg']);
}
$tKey = Tool_Fnc::newrand(4);
$tMd5str = Tool_Fnc::markmd5($pNewptxt, $tKey);
$tData = array('passwd' => $tMd5str, 'id' => $tRow['id'], 'private_key' => $tKey);
if ($tMO->update($tData)) {
Tool_Fnc::ajaxMsg('密码修改成功', 1);
}
Tool_Fnc::ajaxMsg('密码修改失败');
}
示例3: checkToken
/**
* 验证token
* @method checkToken
* @param [type] $uid [description]
* @param [type] $token [description]
* @return [type] [description]
* @author NewFuture
*/
public static function checkToken($uid, $token)
{
if ($user = UserModel::field('id,number,password,sch_id')->find(intval($uid))->get()) {
$base_token = self::createBaseToken($user);
return $token == $base_token ? $user : null;
}
}
示例4: editAction
public function editAction()
{
$p = $_REQUEST;
$pWeight = empty($p['weight']) ? Tool_Fnc::ajaxMsg('干体重不能为空') : floatval($p['weight']);
$tTime = time();
$tDWLMO = new DryweightlogModel();
$tDWLRow = $tDWLMO->field('id')->where('uid = ' . $this->tUid . ' and date = \'' . date('Y-m-d', $tTime) . '\'')->fRow();
$tUMO = new UserModel();
$tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
if ($tURow['user_type'] == 1) {
Tool_Fnc::ajaxMsg('操作异常');
}
$tData = array('weight' => $pWeight);
if (empty($tDWLRow['id'])) {
$tData = array_merge($tData, array('created' => $tTime, 'uid' => $this->tUid, 'date' => date('Y-m-d', $tTime), 'year' => date('Y', $tTime), 'month' => date('Y-m', $tTime)));
} else {
$tData = array_merge($tData, array('updated' => $tTime, 'id' => $tDWLRow['id']));
}
$tUMO->begin();
if (!$tDWLMO->save($tData)) {
$tUMO->back();
Tool_Fnc::ajaxMsg('修改失败 001');
}
$tUData = array('id' => $this->tUid, 'dry_weight' => $pWeight, 'updated' => $tTime);
if (!$tUMO->update($tUData)) {
$tUMO->back();
Tool_Fnc::ajaxMsg('修改失败 002');
}
$tUMO->commit();
Tool_Fnc::ajaxMsg('操作成功', 1);
}
示例5: indexAction
public function indexAction()
{
$p = $_REQUEST;
$pNewptxt = empty($p['newptxt']) ? '' : trim($p['newptxt']);
$pOldptxt = empty($p['oldptxt']) ? '' : trim($p['oldptxt']);
$tTime = time();
if (empty($pOldptxt)) {
Tool_Fnc::ajaxMsg('请输入旧密码');
}
if (empty($pNewptxt)) {
Tool_Fnc::ajaxMsg('请输入新密码');
}
$tUMO = new UserModel();
$tRow = $tUMO->field('id,passwd,private_key')->where('id = ' . $this->tUid)->fRow();
if (!count($tRow)) {
Tool_Fnc::ajaxMsg('读取信息失败');
}
$tOldptxt = Tool_Fnc::markmd5($pOldptxt, $tRow['private_key']);
if ($tRow['passwd'] != $tOldptxt) {
Tool_Fnc::ajaxMsg('旧密码不正确');
}
$tKey = Tool_Fnc::newrand(4);
$tMd5str = Tool_Fnc::markmd5($pNewptxt, $tKey);
$tData = array('id' => $tRow['id'], 'passwd' => $tMd5str, 'private_key' => $tKey, 'updated' => $tTime);
if ($tUMO->update($tData)) {
Tool_Fnc::ajaxMsg('密码修改成功', 1);
}
Tool_Fnc::ajaxMsg('密码修改失败');
}
示例6: is_dryweight
public function is_dryweight($pUid, $pDate)
{
$tTime = time();
$tDatetime = strtotime($pDate);
if ($tTime < $tDatetime) {
return false;
}
$tDWLMO = new DryweightlogModel();
$tRow = $tDWLMO->field('weight')->where('uid = ' . $pUid . ' and date = \'' . $pDate . '\'')->fRow();
if (isset($tRow['weight'])) {
return $tRow['weight'];
}
#判断该日期之前的干体重
$tDWLRow = $tDWLMO->field('weight')->where('uid = ' . $pUid . ' and date < ' . $pDate)->order('date desc')->limit('1')->fRow();
if (count($tDWLRow)) {
self::add_weight($pUid, $pDate, $tDWLRow['weight']);
return $tDWLRow['weight'];
}
#判断该日期之后临近的干体重
$tDWLRow = $tDWLMO->field('weight')->where('uid = ' . $pUid . ' and date > ' . $pDate)->order('date desc')->limit('1')->fRow();
if (count($tDWLRow)) {
self::add_weight($pUid, $pDate, $tDWLRow['weight']);
return $tDWLRow['weight'];
}
#用户干体重
$tUMO = new UserModel();
$tURow = $tUMO->field('dry_weight weight')->where('id = ' . $pUid)->fRow();
if (count($tURow)) {
self::add_weight($pUid, $pDate, $tURow['weight']);
return $tURow['weight'];
}
}
示例7: indexAction
public function indexAction()
{
$p = $_REQUEST;
$pPhone = empty($p['phone']) ? '' : trim($p['phone']);
$pPassword = empty($p['ptxt']) ? '' : trim($p['ptxt']);
$pDid = empty($p['did']) ? '' : trim($p['did']);
$tTime = time();
if (empty($pPhone)) {
Tool_Fnc::ajaxMsg('请输入手机号码');
}
if (empty($pPassword)) {
Tool_Fnc::ajaxMsg('请输入密码');
}
if (!Tool_Validate::mo($pPhone)) {
Tool_Fnc::ajaxMsg('手机号不正确');
}
if (!Tool_Validate::az09($pDid)) {
Tool_Fnc::ajaxMsg('did 错误');
}
$tUserMO = new UserModel();
$tUserRow = $tUserMO->field('private_key')->where('phone = \'' . $pPhone . '\'')->fRow();
$tUkey = empty($tUserRow['private_key']) ? '' : $tUserRow['private_key'];
$tMd5str = Tool_Fnc::markmd5($pPassword, $tUkey);
$tUserRow = $tUserMO->field('id,user_type')->where('phone = \'' . $pPhone . '\' and passwd = \'' . $tMd5str . '\'')->fRow();
if (empty($tUserRow['id'])) {
Tool_Fnc::ajaxMsg("用户名或者密码错误");
}
//添加登陆 记录
$tData = array('uid' => $tUserRow['id'], 'did' => $pDid, 'created' => $tTime, 'ip' => Tool_Fnc::realip());
$tUllMO = new UserloginlogModel();
if (!$tUllMO->insert($tData)) {
Tool_Fnc::ajaxMsg("登录失败");
}
//did入库
$tUDMO = new UserdidModel();
$tUDRow = $tUDMO->field('count(0) c')->where('uid = ' . $tUserRow['id'] . ' and did = \'' . $pDid . '\'')->fRow();
if (empty($tUDRow['c'])) {
$tData = array('uid' => $tUserRow['id'], 'did' => $pDid, 'created' => $tTime, 'ip' => Tool_Fnc::realip());
$tUDMO->insert($tData);
}
$tTokenarr = $this->creattoken($tUserRow['id']);
//匿名转实名
$tUserMO->incognito_real($pDid, $tUserRow['id']);
Tool_Fnc::ajaxMsg("登录成功", 1, array_merge($tTokenarr, array('user_type' => $tUserRow['user_type'])));
//登录成功返回token
}
示例8: GET_phoneAction
/**
* 获取用户真实手机
* GET /user/1/phone
* @method GET_infoAction
* @param integer $id [description]
* @author NewFuture
*/
public function GET_phoneAction($id = 0)
{
$pid = $this->authPrinter();
if (TaskModel::where('use_id', $id)->where('pri_id', $pid)->get('id')) {
$user = UserModel::field('number,phone')->find($id);
$phone = $user ? Encrypt::decryptPhone($user['phone'], $user['number'], $id) : null;
$this->response(1, $phone);
} else {
$this->response(0, '此同学未在此打印过');
}
}
示例9: infoAction
public function infoAction()
{
$p = $_REQUEST;
$pUid = empty($p['id']) ? Tool_Fnc::ajaxMsg("异常错误 001") : intval($p['id']);
$tUMO = new UserModel();
$tURow = $tUMO->field('headimg,nickname,phone,sex,dry_weight,date_of_birth,medical_addr')->where('id = ' . $pUid)->fRow();
$tUAMO = new UserassessmentModel();
$tUARow = $tUAMO->field('*')->where(' uid = ' . $pUid)->fRow();
$this->assign('tURow', $tURow);
$this->assign('tUARow', $tUARow);
}
示例10: indexAction
public function indexAction()
{
$tWeek = date('w', time());
$tODTMO = new OrdinarydialysistimeModel();
$tODTRow = $tODTMO->field('week,time,time_code')->where('uid = ' . $this->tUid)->fRow();
$tODTRow['week'] = empty($tODTRow['week']) ? -1 : $tODTRow['week'];
$tODTRow['time'] = empty($tODTRow['time']) ? '' : $tODTRow['time'];
$tODTRow['time_code'] = empty($tODTRow['time_code']) ? '' : $tODTRow['time_code'];
$tArr = explode('|', $tODTRow['week']);
foreach ($tArr as $k => &$v) {
if ($v == "" || $v == null) {
unset($tArr[$k]);
}
}
$tUMO = new UserModel();
$tURow = $tUMO->field('center_id')->where(' id = ' . $this->tUid . ' and user_type = 0')->fRow();
$tCMO = new CenterModel();
$tCRow = $tCMO->field('name,today_weather')->where('id =' . $tURow['center_id'])->fRow();
$tCRow['name'] = empty($tCRow['name']) ? '' : $tCRow['name'];
$tCRow['today_weather'] = empty($tCRow['today_weather']) ? '' : $tCRow['today_weather'];
$tArray = array();
$tArray['time'] = $tODTRow['time'];
$tArray['time_code'] = $tODTRow['time_code'];
$tArray['medical_addr'] = $tCRow['name'];
$tArray['today_weather'] = $tCRow['today_weather'];
if (in_array($tWeek, $tArr)) {
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => date('Y-m-d', time())), $tArray));
}
if (in_array(($tWeek + 1) % 7, $tArr)) {
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => date('Y-m-d', strtotime('+1day'))), $tArray));
}
if (in_array(($tWeek + 2) % 7, $tArr)) {
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => date('Y-m-d', strtotime('+2day'))), $tArray));
}
if (in_array(($tWeek + 3) % 7, $tArr)) {
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => date('Y-m-d', strtotime('+3day'))), $tArray));
}
if (in_array(($tWeek + 4) % 7, $tArr)) {
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => date('Y-m-d', strtotime('+4day'))), $tArray));
}
if (in_array(($tWeek + 5) % 7, $tArr)) {
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => date('Y-m-d', strtotime('+5day'))), $tArray));
}
if (in_array(($tWeek + 6) % 7, $tArr)) {
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => date('Y-m-d', strtotime('+6day'))), $tArray));
}
Tool_Fnc::ajaxMsg('', 1, array_merge(array('date' => ''), $tArray));
}
示例11: indexAction
public function indexAction()
{
$tUMO = new UserModel();
$tDWLMO = new DryweightlogModel();
$tUDatas = $tUMO->field('id,dry_weight')->fList();
$tTime = time();
$tDate = date('Y-m-d', $tTime);
foreach ($tUDatas as $tURow) {
$tDWLRow = $tDWLMO->field('id')->where('uid = ' . $tURow['id'] . ' and date = \'' . $tDate . '\'')->fRow();
if (!empty($tDWLRow['id'])) {
continue;
}
$tData = array('weight' => $tURow['dry_weight'], 'uid' => $tURow['id'], 'created' => $tTime, 'date' => $tDate, 'year' => date('Y', $tTime), 'month' => date('Y-m', $tTime));
$tDWLMO->insert($tData);
}
exit;
}
示例12: dietAction
public function dietAction()
{
$p = $_REQUEST;
$pDate = empty($p['date']) ? Tool_Fnc::ajaxMsg('日期不能为空') : trim($p['date']);
if (!Tool_Validate::is_date($pDate)) {
Tool_Fnc::ajaxMsg('日期不正确');
}
$tFAMO = new R_FoodaddModel();
$tFMO = new FoodModel();
$tSql = 'select * from (select fid,unit,amount,weight from ' . $tFAMO->table . ' where uid = ' . $this->tUid . ' and created >=' . strtotime($pDate) . ' and created <=' . strtotime($pDate . ' 23:59:59') . ') fa, ' . $tFMO->table . ' f where fa.fid = f.id';
$tList = $tFMO->query($tSql);
# if(!count($tList)){Tool_Fnc::ajaxMsg('',1);}
$tDatas = array();
$tDatasother = array();
#已经摄取
isset($tDatasother['calcium']['number']) ? '' : ($tDatasother['calcium']['number'] = 0);
isset($tDatasother['vitamin_a']['number']) ? '' : ($tDatasother['vitamin_a']['number'] = 0);
isset($tDatasother['zinc']['number']) ? '' : ($tDatasother['zinc']['number'] = 0);
isset($tDatasother['magnesium']['number']) ? '' : ($tDatasother['magnesium']['number'] = 0);
isset($tDatasother['vitamin_c']['number']) ? '' : ($tDatasother['vitamin_c']['number'] = 0);
isset($tDatasother['fiber_dietary']['number']) ? '' : ($tDatasother['fiber_dietary']['number'] = 0);
isset($tDatasother['selenium']['number']) ? '' : ($tDatasother['selenium']['number'] = 0);
isset($tDatasother['copper']['number']) ? '' : ($tDatasother['copper']['number'] = 0);
isset($tDatasother['fat']['number']) ? '' : ($tDatasother['fat']['number'] = 0);
isset($tDatasother['niacin']['number']) ? '' : ($tDatasother['niacin']['number'] = 0);
isset($tDatasother['vitamin_e']['number']) ? '' : ($tDatasother['vitamin_e']['number'] = 0);
isset($tDatasother['manganese']['number']) ? '' : ($tDatasother['manganese']['number'] = 0);
isset($tDatasother['cholesterol']['number']) ? '' : ($tDatasother['cholesterol']['number'] = 0);
isset($tDatasother['iron']['number']) ? '' : ($tDatasother['iron']['number'] = 0);
isset($tDatasother['thiamine']['number']) ? '' : ($tDatasother['thiamine']['number'] = 0);
isset($tDatasother['lactoflavin']['number']) ? '' : ($tDatasother['lactoflavin']['number'] = 0);
isset($tDatasother['calory']['number']) ? '' : ($tDatasother['calory']['number'] = 0);
isset($tDatasother['carotene']['number']) ? '' : ($tDatasother['carotene']['number'] = 0);
isset($tDatas['carbohydrate']['number']) ? '' : ($tDatas['carbohydrate']['number'] = 0);
isset($tDatas['phosphor']['number']) ? '' : ($tDatas['phosphor']['number'] = 0);
isset($tDatas['kalium']['number']) ? '' : ($tDatas['kalium']['number'] = 0);
isset($tDatas['natrium']['number']) ? '' : ($tDatas['natrium']['number'] = 0);
isset($tDatas['protein']['number']) ? '' : ($tDatas['protein']['number'] = 0);
foreach ($tList as $tRow) {
$tDatasother['calcium']['number'] += round($tRow['calcium'] / 100 * $tRow['weight'], 2);
$tDatasother['vitamin_a']['number'] += round($tRow['vitamin_a'] / 100 * $tRow['weight'], 2);
$tDatasother['zinc']['number'] += round($tRow['zinc'] / 100 * $tRow['weight'], 2);
$tDatasother['magnesium']['number'] += round($tRow['magnesium'] / 100 * $tRow['weight'], 2);
$tDatasother['vitamin_c']['number'] += round($tRow['vitamin_c'] / 100 * $tRow['weight'], 2);
$tDatasother['fiber_dietary']['number'] += round($tRow['fiber_dietary'] / 100 * $tRow['weight'], 2);
$tDatasother['selenium']['number'] += round($tRow['selenium'] / 100 * $tRow['weight'], 2);
$tDatasother['copper']['number'] += round($tRow['copper'] / 100 * $tRow['weight'], 2);
$tDatasother['fat']['number'] += round($tRow['fat'] / 100 * $tRow['weight'], 2);
$tDatasother['niacin']['number'] += round($tRow['niacin'] / 100 * $tRow['weight'], 2);
$tDatasother['vitamin_e']['number'] += round($tRow['vitamin_e'] / 100 * $tRow['weight'], 2);
$tDatasother['manganese']['number'] += round($tRow['manganese'] / 100 * $tRow['weight'], 2);
$tDatasother['cholesterol']['number'] += round($tRow['cholesterol'] / 100 * $tRow['weight'], 2);
$tDatasother['iron']['number'] += round($tRow['iron'] / 100 * $tRow['weight'], 2);
$tDatasother['thiamine']['number'] += round($tRow['thiamine'] / 100 * $tRow['weight'], 2);
$tDatasother['lactoflavin']['number'] += round($tRow['lactoflavin'] / 100 * $tRow['weight'], 2);
$tDatasother['calory']['number'] += round($tRow['calory'] / 100 * $tRow['weight'], 2);
$tDatasother['carotene']['number'] += round($tRow['carotene'] / 100 * $tRow['weight'], 2);
$tDatas['carbohydrate']['number'] += round($tRow['carbohydrate'] / 100 * $tRow['weight'], 2);
#碳水化合物
$tDatas['phosphor']['number'] += round($tRow['phosphor'] / 100 * $tRow['weight'] / 1000, 2);
#磷
#$tDatas['kalium']['number'] += round(($tRow['kalium']/100)*$tRow['weight']/1000,2);#钾
$tDatas['natrium']['number'] += round($tRow['natrium'] / 100 * $tRow['weight'] / 1000, 2);
#钠
$tDatas['protein']['number'] += round($tRow['protein'] / 100 * $tRow['weight'], 2);
#蛋白质
}
unset($tList);
#干体重
$tDWLMO = new DryweightlogModel();
$tDWLRow = $tDWLMO->field('weight')->where('uid = ' . $this->tUid . ' and date = \'' . $pDate . '\'')->fRow();
if (!count($tDWLRow)) {
Tool_Fnc::ajaxMsg('', 1);
}
#应摄取
#蛋白质
$tArr = $tFMO->diet('protein', $tDWLRow['weight']);
$tDatas['protein']['total'] = implode('-', $tArr);
$tSurplus = $tArr['end'] - $tDatas['protein']['number'];
$tDatas['protein']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus;
#碳水化合物
$tArr = $tFMO->diet('carbohydrate', $tDWLRow['weight']);
$tDatas['carbohydrate']['total'] = implode('-', $tArr);
$tSurplus = $tArr['end'] - $tDatas['carbohydrate']['number'];
$tDatas['carbohydrate']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus;
#钠
$tArr = $tFMO->diet('natrium');
$tDatas['natrium']['total'] = implode('-', $tArr);
$tSurplus = $tArr['end'] - $tDatas['natrium']['number'];
$tDatas['natrium']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus;
#磷
$tArr = $tFMO->diet('phosphor');
$tDatas['phosphor']['total'] = implode('-', $tArr);
$tSurplus = $tArr['end'] - $tDatas['phosphor']['number'];
$tDatas['phosphor']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus;
#营养摄入评判
#蛋白质
$tDatas['protein']['status'] = $tFMO->diet_status('protein', $tDatas['protein']['number'], $tDWLRow['weight']);
#碳水化合物
$tDatas['carbohydrate']['status'] = $tFMO->diet_status('carbohydrate', $tDatas['carbohydrate']['number'], $tDWLRow['weight']);
//.........这里部分代码省略.........
示例13: indexAction
public function indexAction()
{
$tTime = time();
$tH = date('H', $tTime);
$tRedis = Cache_Redis::instance();
$tMO = new OrdinarydialysistimeModel();
$tODDMO = new OrdinarydialysisdateModel();
$tUMO = new UserModel();
$tUDMO = new UserdidModel();
$tUAMO = new UserassessmentModel();
$tCMO = new CenterModel();
if ($tH >= 7 && $tH <= 11) {
#今日提醒
$tWeek = date('w', $tTime);
$tDate = date('Y-m-d', $tTime);
$tWhere = ' time_code in (2,3)';
$tDatas = $tMO->field('uid,time_code,time')->where($tWhere . ' and week like \'%' . $tWeek . '%\'')->fList();
foreach ($tDatas as $tRow) {
#透析中心信息
$tUARow = $tUAMO->field('medical_id')->where('uid = ' . $tRow['uid'])->fRow();
if (!count($tUARow)) {
continue;
}
$tCRow = $tCMO->field('today_weather,name')->where('id = ' . $tUARow['medical_id'])->fRow();
if (!count($tCRow)) {
continue;
}
$tTitle = '透析提醒';
$tTimecodestr = $tRow['time_code'] == 2 ? '下午' : '晚上';
$tTimecodestr .= $tRow['time'];
$tTpl_val = '#timecodestr#=今日' . $tTimecodestr . '&#name#=' . $tCRow['name'] . '&#weather#=今日天气' . $tCRow['today_weather'];
$tContent = '您#timecodestr#在#name#透析,请准时参加,祝透析顺利。#weather#';
#用户信息
$tURow = $tUMO->field('phone')->where('id = ' . $tRow['uid'])->fRow();
if (!count($tURow)) {
continue;
}
$tRedis->lpush('dakang_sms', serialize(array('content' => $tContent, 'phone' => $tURow['phone'], 'tpl_val' => $tTpl_val, 'type' => 'tx')));
#设备信息
$tSql = 'select cid,devicetoken from (select did from user_did where uid=' . $tRow['uid'] . ') ud,getui where ud.did = getui.did';
$tUDDatas = $tUDMO->query($tSql);
$tTimecodestr = date('m月d日', $tTime) . $tTimecodestr;
$tContent = '您' . $tTimecodestr . '在' . $tCRow['name'] . '透析,请准时参加,祝透析顺利。明日天气' . $tCRow['today_weather'];
foreach ($tUDDatas as $tR) {
$tRes = serialize(array_merge(array('title' => $tTitle, 'content' => $tContent, 'type' => 'tx', 'id' => ''), $tR));
$tRedis->lpush('dakang_getui', $tRes);
}
$tODDRow = $tODDMO->field('count(0) c')->where('uid = ' . $tRow['uid'] . ' and date = \'' . $tDate . '\'')->fRow();
if (!empty($tODDRow['c'])) {
continue;
}
#添加透析日期
$tData = array('date' => $tDate, 'uid' => $tRow['uid'], 'time_code' => $tRow['time_code'], 'created' => $tTime);
$tODDMO->insert($tData);
}
} elseif ($tH >= 13 && $tH <= 21) {
#第二天上午
$tWeek = date('w', $tTime + 86400);
$tDate = date('Y-m-d', $tTime + 86400);
$tWhere = ' time_code = 1';
$tDatas = $tMO->field('uid,time_code,time')->where($tWhere . ' and week like \'%' . $tWeek . '%\'')->fList();
foreach ($tDatas as $tRow) {
#透析中心信息
$tUARow = $tUAMO->field('medical_id')->where('uid = ' . $tRow['uid'])->fRow();
if (!count($tUARow)) {
continue;
}
$tCRow = $tCMO->field('tomorrow_weather,name')->where('id = ' . $tUARow['medical_id'])->fRow();
if (!count($tCRow)) {
continue;
}
$tTitle = '透析提醒';
$tTimecodestr = '上午' . $tRow['time'];
$tTpl_val = '#timecodestr#=明日' . $tTimecodestr . '&#name#=' . $tCRow['name'] . '&#weather#=今日天气' . $tCRow['tomorrow_weather'];
$tContent = '您#timecodestr#在#name#透析,请准时参加,祝透析顺利。#weather#';
#用户信息
$tURow = $tUMO->field('phone')->where('id = ' . $tRow['uid'])->fRow();
if (!count($tURow)) {
continue;
}
$tRedis->lpush('dakang_sms', serialize(array('content' => $tContent, 'phone' => $tURow['phone'], 'tpl_val' => $tTpl_val, 'type' => 'tx')));
#设备信息
$tSql = 'select cid,devicetoken from (select did from user_did where uid=' . $tRow['uid'] . ') ud,getui where ud.did = getui.did';
$tUDDatas = $tUDMO->query($tSql);
$tTimecodestr = date('m月d日', $tTime + 86400) . '上午' . $tRow['time'];
$tContent = '您' . $tTimecodestr . '在' . $tCRow['name'] . '透析,请准时参加,祝透析顺利。明日天气' . $tCRow['tomorrow_weather'];
foreach ($tUDDatas as $tR) {
$tRes = serialize(array_merge(array('title' => $tTitle, 'content' => $tContent, 'type' => 'tx', 'id' => ''), $tR));
$tRedis->lpush('dakang_getui', $tRes);
}
#添加透析日期
$tODDRow = $tODDMO->field('count(0) c')->where('uid = ' . $tRow['uid'] . ' and date = \'' . $tDate . '\'')->fRow();
if (!empty($tODDRow['c'])) {
continue;
}
$tData = array('date' => $tDate, 'uid' => $tRow['uid'], 'time_code' => $tRow['time_code'], 'created' => $tTime);
$tODDMO->insert($tData);
}
}
exit;
//.........这里部分代码省略.........
示例14: indexAction
public function indexAction()
{
$tTime = time();
$tH = date('H', $tTime);
$tMO = new BqeschedulingdetailModel();
$tUMO = new UserModel();
$tUDMO = new UserdidModel();
$tUAMO = new UserassessmentModel();
$tCMO = new CenterModel();
$tRedis = Cache_Redis::instance();
echo '<pre>';
if ($tH >= 7 && $tH <= 11) {
#今日提醒
$tDatas = $tMO->field('uid,time_code')->where('scheduling_date = \'' . date('Y-m-d', $tTime) . '\' and time_code in(2,3) and uid <> 0')->fList();
foreach ($tDatas as $tRow) {
#透析中心信息
$tUARow = $tUAMO->field('medical_id')->where('uid = ' . $tRow['uid'])->fRow();
if (!count($tUARow)) {
continue;
}
$tCRow = $tCMO->field('today_weather,name')->where('id = ' . $tUARow['medical_id'])->fRow();
if (!count($tCRow)) {
continue;
}
$tTitle = '透析提醒';
$tTitle = '透析提醒';
$tTimecodestr = $tRow['time_code'] == 2 ? '下午' : '晚上';
$tTpl_val = '#timecodestr#=今日' . $tTimecodestr . '&#name#=' . $tCRow['name'] . '&#weather#=今日天气' . $tCRow['today_weather'];
$tContent = '您#timecodestr#在#name#透析,请准时参加,祝透析顺利。#weather#';
#用户信息
$tURow = $tUMO->field('phone')->where('id = ' . $tRow['uid'])->fRow();
if (!count($tURow)) {
continue;
}
$tRedis->lpush('dakang_sms', serialize(array('content' => $tContent, 'phone' => $tURow['phone'], 'tpl_val' => $tTpl_val, 'type' => 'tx')));
#设备信息
$tSql = 'select cid,devicetoken from (select did from user_did where uid=' . $tRow['uid'] . ') ud,getui where ud.did = getui.did';
$tUDDatas = $tUDMO->query($tSql);
$tTimecodestr = date('m月d日', $tTime) . $tTimecodestr;
$tContent = '您' . $tTimecodestr . '在' . $tCRow['name'] . '透析,请准时参加,祝透析顺利。明日天气' . $tCRow['today_weather'];
foreach ($tUDDatas as $tR) {
$tRes = serialize(array_merge(array('title' => $tTitle, 'content' => $tContent, 'type' => 'tx', 'id' => ''), $tR));
$tRedis->lpush('dakang_getui', $tRes);
}
}
} elseif ($tH >= 19 && $tH <= 21) {
$tTimeCode = 1;
#第二天上午
$tDatas = $tMO->field('uid')->where('scheduling_date = \'' . date('Y-m-d', $tTime + 86400) . '\' and time_code = ' . $tTimeCode)->fList();
foreach ($tDatas as $tRow) {
#透析中心信息
$tUARow = $tUAMO->field('medical_id')->where('uid = ' . $tRow['uid'])->fRow();
if (!count($tUARow)) {
continue;
}
$tCRow = $tCMO->field('tomorrow_weather,name')->where('id = ' . $tUARow['medical_id'])->fRow();
if (!count($tCRow)) {
continue;
}
$tTitle = '透析提醒';
$tTimecodestr = '上午';
$tTpl_val = '#timecodestr#=明日' . $tTimecodestr . '&#name#=' . $tCRow['name'] . '&#weather#=明日天气' . $tCRow['tomorrow_weather'];
$tContent = '您#timecodestr#在#name#透析,请准时参加,祝透析顺利。#weather#';
#用户信息
$tURow = $tUMO->field('phone')->where('id = ' . $tRow['uid'])->fRow();
if (!count($tURow)) {
continue;
}
$tRedis->lpush('dakang_sms', serialize(array('content' => $tContent, 'phone' => $tURow['phone'])));
#设备信息
$tSql = 'select cid,devicetoken from (select did from user_did where uid=' . $tRow['uid'] . ') ud,getui where ud.did = getui.did';
$tUDDatas = $tUDMO->query($tSql);
$tTimecodestr = date('m月d日', $tTime + 86400) . '上午' . $tRow['time'];
$tContent = '您' . $tTimecodestr . '在' . $tCRow['name'] . '透析,请准时参加,祝透析顺利。明日天气' . $tCRow['tomorrow_weather'];
foreach ($tUDDatas as $tR) {
$tRes = serialize(array_merge(array('title' => $tTitle, 'content' => $tContent, 'type' => 'tx', 'id' => ''), $tR));
$tRedis->lpush('dakang_getui', $tRes);
}
}
}
}
示例15: indexAction
public function indexAction()
{
$p = $_REQUEST;
//判断用户是否为白求恩用户
$tUMO = new UserModel();
$tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
if (empty($tURow) || $tURow['user_type'] == 1) {
Tool_Fnc::ajaxMsg('操作错误');
}
$tData = array();
$pPatientId = !isset($p['patient_id']) ? '' : ($tData['patient_id'] = Tool_Fnc::safe_string($p['patient_id']));
$pInpNo = !isset($p['inp_no']) ? '' : ($tData['inp_no'] = Tool_Fnc::safe_string($p['inp_no']));
$pMedicalDate01 = !isset($p['medical_date_01']) ? '' : ($tData['medical_date_01'] = Tool_Fnc::safe_string($p['medical_date_01'] . '-01'));
$pMedicalDate02 = !isset($p['medical_date_02']) ? '' : ($tData['medical_date_02'] = Tool_Fnc::safe_string($p['medical_date_02'] . '-01'));
$pMedicalDate03 = !isset($p['medical_date_03']) ? '' : ($tData['medical_date_03'] = Tool_Fnc::safe_string($p['medical_date_03'] . '-01'));
$pMedicalDate04 = !isset($p['medical_date_04']) ? '' : ($tData['medical_date_04'] = Tool_Fnc::safe_string($p['medical_date_04'] . '-01'));
$pPresent01 = !isset($p['present_01']) ? '' : ($tData['present_01'] = Tool_Fnc::safe_string($p['present_01']));
$pPresent02 = !isset($p['present_02']) ? '' : ($tData['present_02'] = Tool_Fnc::safe_string($p['present_02']));
$pPresent03 = !isset($p['present_03']) ? '' : ($tData['present_03'] = Tool_Fnc::safe_string($p['present_03']));
$pPresent04 = !isset($p['present_04']) ? '' : ($tData['present_04'] = Tool_Fnc::safe_string($p['present_04']));
$pPresent05 = !isset($p['present_05']) ? '' : ($tData['present_05'] = Tool_Fnc::safe_string($p['present_05']));
$pPresent06 = !isset($p['present_06']) ? '' : ($tData['present_06'] = Tool_Fnc::safe_string($p['present_06']));
$pPresent07 = !isset($p['present_07']) ? '' : ($tData['present_07'] = Tool_Fnc::safe_string($p['present_07']));
$pPresent08 = !isset($p['present_08']) ? '' : ($tData['present_08'] = Tool_Fnc::safe_string($p['present_08']));
$pPresent09 = !isset($p['present_09']) ? '' : ($tData['present_09'] = Tool_Fnc::safe_string($p['present_09']));
$pPresent10 = !isset($p['present_10']) ? '' : ($tData['present_10'] = Tool_Fnc::safe_string($p['present_10']));
$pPresent11 = !isset($p['present_11']) ? '' : ($tData['present_11'] = Tool_Fnc::safe_string($p['present_11']));
$pPresent12 = !isset($p['present_12']) ? '' : ($tData['present_12'] = Tool_Fnc::safe_string($p['present_12']));
$pPresent13 = !isset($p['present_13']) ? '' : ($tData['present_13'] = Tool_Fnc::safe_string($p['present_13']));
$pPresent14 = !isset($p['present_14']) ? '' : ($tData['present_14'] = Tool_Fnc::safe_string($p['present_14']));
$pPresent15 = !isset($p['present_15']) ? '' : ($tData['present_15'] = Tool_Fnc::safe_string($p['present_15']));
$pPresent16 = !isset($p['present_16']) ? '' : ($tData['present_16'] = Tool_Fnc::safe_string($p['present_16']));
$pPresent17 = !isset($p['present_17']) ? '' : ($tData['present_17'] = Tool_Fnc::safe_string($p['present_17']));
$pPresent18 = !isset($p['present_18']) ? '' : ($tData['present_18'] = Tool_Fnc::safe_string($p['present_18']));
$pPresent19 = !isset($p['present_19']) ? '' : ($tData['present_19'] = Tool_Fnc::safe_string($p['present_19']));
$pPresent20 = !isset($p['present_20']) ? '' : ($tData['present_20'] = Tool_Fnc::safe_string($p['present_20']));
$pPresent21 = !isset($p['present_21']) ? '' : ($tData['present_21'] = Tool_Fnc::safe_string($p['present_21']));
$pPresent22 = !isset($p['present_22']) ? '' : ($tData['present_22'] = Tool_Fnc::safe_string($p['present_22']));
$pPresent23 = !isset($p['present_23']) ? '' : ($tData['present_23'] = Tool_Fnc::safe_string($p['present_23']));
$pPresent24 = !isset($p['present_24']) ? '' : ($tData['present_24'] = Tool_Fnc::safe_string($p['present_24']));
$pComplication01 = !isset($p['complication_01']) ? '' : ($tData['complication_01'] = Tool_Fnc::safe_string($p['complication_01']));
$pComplication02 = !isset($p['complication_02']) ? '' : ($tData['complication_02'] = Tool_Fnc::safe_string($p['complication_02']));
$pComplication03 = !isset($p['complication_03']) ? '' : ($tData['complication_03'] = Tool_Fnc::safe_string($p['complication_03']));
$pComplication04 = !isset($p['complication_04']) ? '' : ($tData['complication_04'] = Tool_Fnc::safe_string($p['complication_04']));
$pComplication05 = !isset($p['complication_05']) ? '' : ($tData['complication_05'] = Tool_Fnc::safe_string($p['complication_05']));
$pComplication06 = !isset($p['complication_06']) ? '' : ($tData['complication_06'] = Tool_Fnc::safe_string($p['complication_06']));
$pMedPast011 = !isset($p['med_past_011']) ? '' : ($tData['med_past_011'] = Tool_Fnc::safe_string($p['med_past_011']));
$pMedPast012 = !isset($p['med_past_012']) ? '' : ($tData['med_past_012'] = Tool_Fnc::safe_string($p['med_past_012']));
$pMedPast013 = !isset($p['med_past_013']) ? '' : ($tData['med_past_013'] = Tool_Fnc::safe_string($p['med_past_013']));
$pMedPast021 = !isset($p['med_past_021']) ? '' : ($tData['med_past_021'] = Tool_Fnc::safe_string($p['med_past_021']));
$pMedPast022 = !isset($p['med_past_022']) ? '' : ($tData['med_past_022'] = Tool_Fnc::safe_string($p['med_past_022']));
$pMedPast031 = !isset($p['med_past_031']) ? '' : ($tData['med_past_031'] = Tool_Fnc::safe_string($p['med_past_031']));
$pMedPast032 = !isset($p['med_past_032']) ? '' : ($tData['med_past_032'] = Tool_Fnc::safe_string($p['med_past_032']));
$pMedPast033 = !isset($p['med_past_033']) ? '' : ($tData['med_past_033'] = Tool_Fnc::safe_string($p['med_past_033']));
$pMedPast034 = !isset($p['med_past_034']) ? '' : ($tData['med_past_034'] = Tool_Fnc::safe_string($p['med_past_034']));
$pMedPast035 = !isset($p['med_past_035']) ? '' : ($tData['med_past_035'] = Tool_Fnc::safe_string($p['med_past_035']));
$pMedPast036 = !isset($p['med_past_036']) ? '' : ($tData['med_past_036'] = Tool_Fnc::safe_string($p['med_past_036']));
$pMedPast037 = !isset($p['med_past_037']) ? '' : ($tData['med_past_037'] = Tool_Fnc::safe_string($p['med_past_037']));
$pMedPast041 = !isset($p['med_past_041']) ? '' : ($tData['med_past_041'] = Tool_Fnc::safe_string($p['med_past_041']));
$pMedPast042 = !isset($p['med_past_042']) ? '' : ($tData['med_past_042'] = Tool_Fnc::safe_string($p['med_past_042']));
$pMedPast043 = !isset($p['med_past_043']) ? '' : ($tData['med_past_043'] = Tool_Fnc::safe_string($p['med_past_043']));
$pMedPast044 = !isset($p['med_past_044']) ? '' : ($tData['med_past_044'] = Tool_Fnc::safe_string($p['med_past_044']));
$pMedPast045 = !isset($p['med_past_045']) ? '' : ($tData['med_past_045'] = Tool_Fnc::safe_string($p['med_past_045']));
$pMedPast046 = !isset($p['med_past_046']) ? '' : ($tData['med_past_046'] = Tool_Fnc::safe_string($p['med_past_046']));
$pMedPast05 = !isset($p['med_past_05']) ? '' : ($tData['med_past_05'] = Tool_Fnc::safe_string($p['med_past_05']));
$pMedPast06 = !isset($p['med_past_06']) ? '' : ($tData['med_past_06'] = Tool_Fnc::safe_string($p['med_past_06']));
$pMedPast07 = !isset($p['med_past_07']) ? '' : ($tData['med_past_07'] = Tool_Fnc::safe_string($p['med_past_07']));
$pMedPast08 = !isset($p['med_past_08']) ? '' : ($tData['med_past_08'] = Tool_Fnc::safe_string($p['med_past_08']));
$pMedPast09 = !isset($p['med_past_09']) ? '' : ($tData['med_past_09'] = Tool_Fnc::safe_string($p['med_past_09']));
$pMedPast10 = !isset($p['med_past_10']) ? '' : ($tData['med_past_10'] = Tool_Fnc::safe_string($p['med_past_10']));
$pMedPast11 = !isset($p['med_past_11']) ? '' : ($tData['med_past_11'] = Tool_Fnc::safe_string($p['med_past_11']));
$pMedPast12 = !isset($p['med_past_12']) ? '' : ($tData['med_past_12'] = Tool_Fnc::safe_string($p['med_past_12']));
$pMedPast13 = !isset($p['med_past_13']) ? '' : ($tData['med_past_13'] = Tool_Fnc::safe_string($p['med_past_13']));
$pBodyHeight = !isset($p['body_height']) ? '' : ($tData['body_height'] = floatval($p['body_height']));
$pDialysisNo = !isset($p['dialysis_no']) ? '' : ($tData['dialysis_no'] = floatval($p['dialysis_no']));
$pAnticoagulation = !isset($p['anticoagulation']) ? '' : ($tData['anticoagulation'] = Tool_Fnc::safe_string($p['anticoagulation']));
$pIfIn = !isset($p['if_in']) ? '' : ($tData['if_in'] = Tool_Fnc::safe_string($p['if_in']));
$pWeeks = !isset($p['weeks']) ? '' : ($tData['weeks'] = floatval($p['weeks']));
$pPresent101 = !isset($p['present_10_1']) ? '' : ($tData['present_10_1'] = Tool_Fnc::safe_string($p['present_10_1']));
$pPresent041 = !isset($p['present_04_1']) ? '' : ($tData['present_04_1'] = Tool_Fnc::safe_string($p['present_04_1']));
$pPresent201 = !isset($p['present_20_1']) ? '' : ($tData['present_20_1'] = Tool_Fnc::safe_string($p['present_20_1']));
$pPresent241 = !isset($p['present_24_1']) ? '' : ($tData['present_24_1'] = Tool_Fnc::safe_string($p['present_24_1']));
$pMedPast051 = !isset($p['med_past_05_1']) ? '' : ($tData['med_past_05_1'] = Tool_Fnc::safe_string($p['med_past_05_1']));
$pMedPast061 = !isset($p['med_past_06_1']) ? '' : ($tData['med_past_06_1'] = Tool_Fnc::safe_string($p['med_past_06_1']));
$pMedPast071 = !isset($p['med_past_07_1']) ? '' : ($tData['med_past_07_1'] = Tool_Fnc::safe_string($p['med_past_07_1']));
$pMedPast081 = !isset($p['med_past_08_1']) ? '' : ($tData['med_past_08_1'] = Tool_Fnc::safe_string($p['med_past_08_1']));
$pMedPast091 = !isset($p['med_past_09_1']) ? '' : ($tData['med_past_09_1'] = Tool_Fnc::safe_string($p['med_past_09_1']));
$pMedPast101 = !isset($p['med_past_10_1']) ? '' : ($tData['med_past_10_1'] = Tool_Fnc::safe_string($p['med_past_10_1']));
$pMedPast111 = !isset($p['med_past_11_1']) ? '' : ($tData['med_past_11_1'] = Tool_Fnc::safe_string($p['med_past_11_1']));
$pMedPast121 = !isset($p['med_past_12_1']) ? '' : ($tData['med_past_12_1'] = Tool_Fnc::safe_string($p['med_past_12_1']));
$pMedPast131 = !isset($p['med_past_13_1']) ? '' : ($tData['med_past_13_1'] = Tool_Fnc::safe_string($p['med_past_13_1']));
$pMedPast102 = !isset($p['med_past_10_2']) ? '' : ($tData['med_past_10_2'] = Tool_Fnc::safe_string($p['med_past_10_2']));
$pMethod = !isset($p['method']) ? '' : ($tData['method'] = intval($p['method']));
$pMedicalType = !isset($p['medical_type']) ? '' : ($tData['medical_type'] = Tool_Fnc::safe_string($p['medical_type']));
$pProvinces = !isset($p['provinces']) ? '' : ($tData['provinces'] = Tool_Fnc::safe_string($p['provinces']));
$pCities = !isset($p['cities']) ? '' : ($tData['cities'] = Tool_Fnc::safe_string($p['cities']));
$pMedicalAddr = !isset($p['medical_addr']) ? '' : ($tData['medical_addr'] = Tool_Fnc::safe_string($p['medical_addr']));
$pName = !isset($p['name']) ? '' : ($tData['name'] = Tool_Fnc::safe_string($p['name']));
$tTime = time();
$pAssessTime = !isset($p['assess_time']) ? '' : ($tData['assess_time'] = Tool_Fnc::safe_string($p['assess_time']));
//.........这里部分代码省略.........