$rs[] = array_elements(array('id', 'type', 'title'), $row); } } exit(json_encode($rs)); } if ($foo == 'create') { if ($_W['ispost']) { $input = array_elements(array('title', 'type', 'remark'), $_GPC); $input['remark'] = htmlspecialchars_decode($input['remark']); if ($input['type'] == 'cash') { $input['tag'] = serialize($_GPC['cash']); } else { $input['tag'] = ''; } $g = new Gift(); $ret = $g->create($input); if (is_error($ret)) { message($ret['message']); } else { message('成功保存礼品信息', $this->createWebUrl('gifts')); } } $entity = array(); $entity['type'] = 'cash'; $entity['tag'] = array(); load()->func('tpl'); include $this->template('gifts-form'); } if ($foo == 'modify') { $id = $_GPC['id']; $g = new Gift();
public function doWebRedGifts() { global $_W, $_GPC; if (!$_W['ispost']) { $this->doWebAuth(); checklogin(); } $modulePublic = '../addons/wwx_fxxt/style/static/'; $foo = $_GPC['foo']; $foos = array('list', 'create', 'modify', 'delete', 'search'); $foo = in_array($foo, $foos) ? $foo : 'list'; require_once WWX_FXXT_ROOT . '/class/Gift.class.php'; if ($foo == 'search') { $fuzzy = $_GPC['fuzzy']; $filters = array(); $filters['title'] = $fuzzy; $g = new Gift(); $ds = $g->getAll($filters, 1, 20); /**GIFT:2.查询所有活动礼品分类**/ $rs = array(); if (!empty($ds)) { foreach ($ds as $row) { $rs[] = array_elements(array('id', 'type', 'title'), $row); } } exit(json_encode($rs)); } if ($foo == 'create') { if ($_W['ispost']) { $input = array_elements(array('title', 'type', 'remark'), $_GPC); $input['remark'] = htmlspecialchars_decode($input['remark']); if ($input['type'] == 'cash') { $input['tag'] = serialize($_GPC['cash']); } else { $input['tag'] = ''; } $g = new Gift(); $ret = $g->create($input); /**GIFT:3.编辑活动礼品分类**/ if (is_error($ret)) { message($ret['message']); } else { message('成功保存礼品信息', $this->createWebUrl('redgifts')); } } $entity = array(); $entity['type'] = 'cash'; $entity['tag'] = array(); load()->func('tpl'); include $this->template('redgifts_form'); } if ($foo == 'modify') { $id = $_GPC['id']; $g = new Gift(); $entity = $g->getOne($id); /**GIFT:1.根据ID查询活动礼品分类**/ if (empty($entity)) { message('访问错误'); } if ($_W['ispost']) { $input = array_elements(array('title', 'type', 'remark'), $_GPC); $input['remark'] = htmlspecialchars_decode($input['remark']); if ($input['type'] == 'cash') { $input['tag'] = serialize($_GPC['cash']); } else { $input['tag'] = ''; } $g = new Gift(); $ret = $g->modify($id, $input); /**GIFT:4.根据ID编辑活动礼品分类**/ if (is_error($ret)) { message($ret['message']); } else { message('成功保存礼品信息', $this->createWebUrl('redgifts')); } } load()->func('tpl'); include $this->template('redgifts_form'); } if ($foo == 'delete') { $id = $_GPC['id']; $g = new Gift(); $g->remove($id); /**GIFT:5.根据ID删除活动礼品分类**/ message('成功删除礼品信息', $this->createWebUrl('redgifts')); } if ($foo == 'list') { $a = new Gift(); $ds = $a->getAll(array()); /**GIFT:2.查询所有活动礼品分类**/ include $this->template('redgifts_list'); } }
public function run() { $i = 0; for ($i = 0; $i < 50; $i++) { Gift::create(['topic_id' => $i + 1, 'title' => '新款阿登', 'price' => '999', 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', 'gift_photo_intro' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', 'scan_num' => rand(1111, 8888), 'focus_num' => rand(1111, 8888), 'taobao_url' => 'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043']); Gift::create(['topic_id' => $i + 1, 'title' => '新款阿登', 'price' => '999', 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', 'gift_photo_intro' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', 'scan_num' => rand(1111, 8888), 'focus_num' => rand(1111, 8888), 'taobao_url' => 'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043']); Gift::create(['topic_id' => $i + 1, 'title' => '新款阿登', 'price' => '999', 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', 'gift_photo_intro' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', 'scan_num' => rand(1111, 8888), 'focus_num' => rand(1111, 8888), 'taobao_url' => 'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043']); Gift::create(['topic_id' => $i + 1, 'title' => '新款阿登', 'price' => '999', 'content' => 'live younger,you need it, trust me', 'gift_photo_intro' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', 'scan_num' => rand(1111, 8888), 'focus_num' => rand(1111, 8888), 'taobao_url' => 'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043']); } // Gift::create([ // 'topic_id'=>1, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>1, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>1, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>1, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => 'live younger,you need it, trust me', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>2, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>2, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>2, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>2, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => 'live younger,you need it, trust me', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>3, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>3, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>3, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>3, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => 'live younger,you need it, trust me', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>4, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>4, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>4, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => '床上总是很多零碎的杂物,不知道放在哪里。有了这个宿舍床头收纳架,就不怕床上没空间了。手机、水杯、充电器统统装得下,实用性强而且色彩明亮。舒服温馨的宿舍生活就靠它了。', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); // Gift::create([ // 'topic_id'=>4, // 'title' => '新款阿登', // 'price' =>'999', // 'content' => 'live younger,you need it, trust me', // 'gift_photo_intro' =>'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', // 'scan_num' => '7859', // 'focus_num' => '7557', // 'taobao_url' =>'https://detail.tmall.com/item.htm?spm=a217e.7765654.1998660470.7.a4lzKx&id=521089667043' // ]); }