本文整理汇总了PHP中Sequence::nextval方法的典型用法代码示例。如果您正苦于以下问题:PHP Sequence::nextval方法的具体用法?PHP Sequence::nextval怎么用?PHP Sequence::nextval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::nextval方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveMsg
/**
* 被下单、加菜、在线支付、信息反馈等调用
* 对应的cmd分别是XD、JC、ZXZF、XXFK
* data的格式按照接口文档封装
*/
protected function saveMsg($cmd, $data)
{
$db = Yii::app()->db;
$se = new Sequence("data_sync");
$this->lid = $se->nextval();
$sql = 'insert into nb_data_sync(lid,dpid,cmd_code,cmd_data,create_at,is_interface,sync_result) values(:lid,:dpid,:cmd_code,:cmd_data,sysdate(),:is_interface,:sync_result)';
$command = $db->createCommand($sql);
$command->bindValue(":lid", $this->lid);
$command->bindValue(":dpid", $this->dpid);
$command->bindValue(":cmd_code", $cmd);
$command->bindValue(":cmd_data", $data);
$command->bindValue(":is_interface", '1');
$command->bindValue(":sync_result", '0');
$command->execute();
/*$ds=new DataSync;
$se=new Sequence("data_sync");
$this->lid = $se->nextval();
$ds->dpid = $this->dpid;
$ds->lid = $this->lid;
$ds->cmd_code = $cmd;
$ds->cmd_data =$data;
$ds->create_at = date('y-m-d h:i:s',time());
$ds->is_interface = '1';
$ds->sync_result = '0';
$ds->save();*/
}
示例2: actionCreate
public function actionCreate()
{
$model = new Product();
$model->dpid = $this->companyId;
//$model->create_time = time();
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('Product');
$se = new Sequence("product");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->update_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
$py = new Pinyin();
$model->simple_code = $py->py($model->product_name);
//var_dump($model);exit;
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功!'));
$this->redirect(array('product/index', 'companyId' => $this->companyId));
}
}
$categories = $this->getCategoryList();
//$departments = $this->getDepartments();
//echo 'ss';exit;
$this->render('create', array('model' => $model, 'categories' => $categories));
}
示例3: actionCreate
public function actionCreate()
{
$typeId = Yii::app()->request->getParam('typeId', 0);
$model = new Site();
$model->dpid = $this->companyId;
$model->type_id = $typeId;
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('Site');
$se = new Sequence("site");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->update_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
//var_dump($model);exit;
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('site/index', 'typeId' => $typeId, 'companyId' => $this->companyId));
}
}
$types = $this->getTypes();
$floors = $this->getFloors();
$sitepersons = $this->getSitePersons();
//var_dump($floors);
//var_dump($types);exit;
$this->render('create', array('model' => $model, 'types' => $types, 'floors' => $floors, 'sitepersons' => $sitepersons));
}
示例4: actionGetSitePersons
public function actionGetSitePersons()
{
$companyid = Yii::app()->request->getParam('companyid', 0);
$padid = Yii::app()->request->getParam('padid', 0);
$stlid = Yii::app()->request->getParam('stlid', 0);
$splid = Yii::app()->request->getParam('splid', 0);
$ret = array();
$nowqueueno = "000";
$queueno = "A001";
$waitingno = 0;
if (empty($companyid) || empty($padid)) {
Yii::app()->end(json_encode(array('status' => false, 'msg' => '店铺或设备不存在!')));
}
$pad = Pad::model()->with("printer")->find(' t.dpid=:companyId and t.lid=:padid', array(':companyId' => $companyid, ':padid' => $padid));
//var_dump($pad);exit;
if (!empty($pad)) {
//生成新的排队号
$siteType = SiteType::model()->find(" dpid=:dpid and lid=:lid", array(":dpid" => $companyid, ":lid" => $stlid));
//var_dump($siteType);exit;
$criteria = new CDbCriteria();
$criteria->condition = " dpid=" . $companyid . " and stlid=" . $stlid . " and splid=" . $splid . " and create_at >='" . date('Y-m-d', time()) . " 00:00:00' and create_at <='" . date('Y-m-d', time()) . " 23:59:59'";
$criteria->order = ' lid ';
$queuePerson = QueuePersons::model()->findAll($criteria);
if (empty($siteType)) {
Yii::app()->end(json_encode(array('status' => false, 'msg' => '座位类型不存在!')));
}
//var_dump($queuePerson);exit;
if (!empty($queuePerson)) {
$countsp = count($queuePerson);
$queueno = $siteType->simplecode . substr("000" . (string) ($countsp + 1), -3);
for ($sti = $countsp - 1; $sti >= 0; $sti--) {
if ($queuePerson[$sti]->status == "0") {
$waitingno++;
} else {
break;
}
}
} else {
$queueno = $siteType->simplecode . "001";
$waitingno = 0;
}
$se = new Sequence("queue_persons");
$queuelid = $se->nextval();
$data = array('lid' => $queuelid, 'dpid' => $companyid, 'create_at' => date('Y-m-d H:i:s', time()), 'update_at' => date('Y-m-d H:i:s', time()), 'stlid' => $stlid, 'splid' => $splid, 'queue_no' => $queueno, 'status' => '0', 'slid' => "0000000000", 'delete_flag' => '0');
Yii::app()->db->createCommand()->insert('nb_queue_persons', $data);
$waitingno++;
//返回现有的等待人数
$precode = "";
$printserver = "0";
//
$memo = "排队号:" . $queueno . ",(还有" . $waitingno . "组在等待)";
$ret = Helper::printQueue($pad, $precode, $printserver, $memo);
if ($ret['status']) {
$ret['waitingnum'] = $waitingno;
}
} else {
$ret = array('status' => false, 'msg' => '没有找到PAD');
}
Yii::app()->end(json_encode($ret));
}
示例5: actionCreate
public function actionCreate()
{
$model = new ProductAddition();
$model->dpid = $this->companyId;
$pslid = Yii::app()->request->getParam('psid');
$model->mproduct_id = $pslid;
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('ProductAddition');
//var_dump($model->attributes);exit;
$se = new Sequence("product_addition");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->update_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
//var_dump($model);exit;
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('productAddition/detail', 'companyId' => $this->companyId, 'lid' => $model->mproduct_id));
}
}
$categories = $this->getCategories();
$categoryId = 0;
$products = $this->getProducts($categoryId);
$productslist = CHtml::listData($products, 'lid', 'product_name');
$this->render('detailcreate', array('model' => $model, 'categories' => $categories, 'categoryId' => $categoryId, 'products' => $productslist));
}
示例6: saveCmd
public function saveCmd($cmd)
{
//$ds=new DataSync();
$db = Yii::app()->db;
$se = new Sequence("data_sync");
$this->lid = $se->nextval();
$sql = 'insert into nb_data_sync(lid,dpid,cmd_code,cmd_data,create_at,is_interface,sync_result) values(:lid,:dpid,:cmd_code,:cmd_data,sysdate(),:is_interface,:sync_result)';
$command = $db->createCommand($sql);
$command->bindValue(":lid", $this->lid);
$command->bindValue(":dpid", $this->dpid);
$command->bindValue(":cmd_code", $cmd);
$command->bindValue(":cmd_data", '');
$command->bindValue(":is_interface", '1');
$command->bindValue(":sync_result", '0');
$command->execute();
/*
$ds->dpid = $this->dpid;
$ds->lid = $this->lid;
$ds->cmd_code = $cmd;
$ds->cmd_data = '';
$ds->create_at = date('y-m-d h:i:s',time());
$ds->is_interface = '1';
$ds->sync_result = '0';
//var_dump($ds);
if(!$ds->save())
{
var_dump($ds->getErrors());
echo 'insert error!!!!';
}*/
}
示例7: actionCreate
public function actionCreate()
{
$model = new SitePersons();
$model->dpid = $this->companyId;
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('SitePersons');
$se = new Sequence("site_type");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->update_at = date('Y-m-d H:i:s', time());
//var_dump($model);exit;
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('sitePersons/index', 'companyId' => $this->companyId));
}
}
$this->render('create', array('model' => $model));
}
示例8: actionCreate
public function actionCreate()
{
$model = new Printer();
$model->dpid = $this->companyId;
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('Printer');
$se = new Sequence("printer");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->update_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('printer/index', 'companyId' => $this->companyId));
}
}
$this->render('create', array('model' => $model));
}
示例9: actionCreate
public function actionCreate()
{
$companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
$model = new CompanyWifi();
$model->dpid = $companyId;
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('CompanyWifi');
$se = new Sequence("company_wifi");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s');
$model->update_at = date('Y-m-d H:i:s');
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('companyWifi/index', 'companyId' => $companyId));
}
}
$this->render('create', array('model' => $model));
}
示例10: actionCreate
public function actionCreate()
{
$companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
$model = new PaymentMethod();
$model->dpid = $companyId;
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('PaymentMethod');
$se = new Sequence("payment_method");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s');
$model->update_at = date('Y-m-d H:i:s', time());
// var_dump($model->attributes);exit;
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('payMethod/index', 'companyId' => $companyId));
}
}
$this->render('create', array('model' => $model));
}
示例11: actionCreate
public function actionCreate()
{
$allflag = Yii::app()->request->getParam('allflag', 0);
$model = new Feedback();
$model->dpid = $this->companyId;
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('Feedback');
$se = new Sequence("feedback");
$model->lid = $se->nextval();
$model->allflag = $allflag;
$model->create_at = date('Y-m-d H:i:s', time());
$model->update_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
//var_dump($model);exit;
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('feedback/index', 'companyId' => $this->companyId, 'allflag' => $allflag));
}
}
$this->render('create', array('model' => $model, 'allflag' => $allflag));
}
示例12: actionCreate
public function actionCreate()
{
$this->layout = '/layouts/main_picture';
$pid = Yii::app()->request->getParam('pid', 0);
$model = new ProductCategory();
$model->dpid = $this->companyId;
if ($pid) {
$model->pid = $pid;
}
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('ProductCategory');
$category = ProductCategory::model()->find('dpid=:dpid and category_name=:name and delete_flag=0', array(':dpid' => $this->companyId, ':name' => $model->category_name));
if ($category) {
$this->redirect(array('productCategory/index', 'id' => $category->lid, 'companyId' => $this->companyId));
}
$se = new Sequence("product_category");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
$model->update_at = date('Y-m-d H:i:s', time());
if ($model->save()) {
//var_dump($model);exit;
$self = ProductCategory::model()->find('lid=:pid and dpid=:dpid', array(':pid' => $model->lid, ':dpid' => $this->companyId));
if ($self->pid != '0') {
$parent = ProductCategory::model()->find('lid=:pid and dpid=:dpid', array(':pid' => $model->pid, ':dpid' => $this->companyId));
$self->tree = $parent->tree . ',' . $self->lid;
} else {
$self->tree = '0,' . $self->lid;
}
//var_dump($model);exit;
$self->update();
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('productCategory/index', 'id' => $self->lid, 'companyId' => $this->companyId));
} else {
Yii::app()->user->setFlash('error', yii::t('app', '添加失败'));
$this->redirect(array('productCategory/index', 'companyId' => $this->companyId));
}
}
$this->render('_form1', array('model' => $model, 'action' => $this->createUrl('productCategory/create', array('companyId' => $this->companyId))));
}
示例13: actionCreate
public function actionCreate()
{
$productId = Yii::app()->request->getParam('productId');
$model = new ProductDiscount();
$model->dpid = $this->companyId;
$product = Product::model()->find('lid=:lid and dpid=:dpid and delete_flag=0', array(':lid' => $productId, ':dpid' => $this->companyId));
// $productSets = ProductSet::model()->findAll('dpid=:dpid and delete_flag=0 and is_discount=1 and status=0',array(':dpid'=>$this->companyId));
if (Yii::app()->request->isPostRequest) {
$postData = Yii::app()->request->getPost('ProductDiscount');
$model->attributes = $postData;
$se = new Sequence("retreat");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->update_at = date('Y-m-d H:i:s', time());
if ($model->save()) {
Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
$this->redirect(array('productSales/updatedetail', 'companyId' => $this->companyId, 'id' => $productId));
}
}
// var_dump($products);exit;
$this->render('create', array('model' => $model, 'product' => $product));
}
示例14: save
public function save()
{
if ($this->lid) {
$model = User::model()->find('lid=:id', array(':id' => $this->lid));
} else {
$model = new User();
$se = new Sequence("user");
$model->lid = $se->nextval();
$model->create_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
//$model->lid = $this->getPkValue();
}
$model->username = $this->username;
$model->mobile = $this->mobile;
$model->staff_no = $this->staff_no;
$model->email = $this->email;
$model->role = $this->role;
$model->dpid = $this->dpid;
$model->status = 1;
if ($this->password_old != $this->password) {
$model->password_hash = $this->password;
}
if ($model->validate()) {
if ($this->password_old != $this->password) {
$model->password_hash = Helper::genPassword($this->password);
}
//var_dump($model);exit;
$model->save();
return true;
} else {
$this->addErrors($model->getErrors());
if ($passwordError = $model->getError('password_hash')) {
$this->addError('password', $passwordError);
}
return false;
}
}
示例15: actionCharge
public function actionCharge()
{
$model = new MemberRecharge();
$model->dpid = $this->companyId;
//Until::validOperate($model->dpid, $this);
if (Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('MemberRecharge');
$rfid = Yii::app()->request->getPost('rfid');
$transaction = Yii::app()->db->beginTransaction();
try {
$member = MemberCard::model()->find('rfid=:rfid and selfcode=:selfcode and dpid=:dpid', array(':rfid' => $rfid, ':selfcode' => $model->member_card_id, ':dpid' => $this->companyId));
Until::validOperate($member->lid, $this);
//var_dump($member);exit;
$member->all_money = $member->all_money + $model->reality_money + $model->give_money;
$se = new Sequence("member_recharge");
$model->lid = $se->nextval();
$model->update_at = date('Y-m-d H:i:s', time());
$model->create_at = date('Y-m-d H:i:s', time());
$model->delete_flag = '0';
if ($model->save() && $member->update()) {
$transaction->commit();
Yii::app()->user->setFlash('success', yii::t('app', '充值成功'));
} else {
$transaction->rollback();
Yii::app()->user->setFlash('error', yii::t('app', '充值失败'));
}
} catch (Exception $e) {
Yii::app()->user->setFlash('error', yii::t('app', '充值失败'));
$transaction->rollback();
}
$this->redirect(array('member/index', 'companyId' => $this->companyId));
}
$this->renderPartial('charge', array('model' => $model));
}