Example #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     //		 $this->call('UserTableSeeder');
     DB::table('users')->truncate();
     User::create(['id' => 1, 'username' => 'admin', 'email' => '*****@*****.**', 'password' => \Hash::make('11431143'), 'role' => User::ROLE_ADMIN, 'status' => User::STATUS_NORMAL]);
     DB::table('suppliers')->truncate();
     Supplier::create(['id' => 1, 'username' => 'nanpufood', 'email' => '*****@*****.**', 'title' => '南浦集团', 'description' => '快速消费品综合代理和营销集团', 'service_phone' => '021-61923399', 'status' => 1]);
     //店铺
     DB::table('shops')->truncate();
     Shop::create(['id' => 1, 'short_id' => "yayao", 'province_id' => 310000, 'city_id' => 310100, 'county_id' => 310110, 'type' => 2, 'name' => '丫摇官方直营店', 'seller_id' => 1, 'thumbnail' => '', 'title' => '丫摇小店', 'subtitle' => '丫摇官方直营店', 'is_direct_sale' => Shop::IS_DIRECT_SALE_YES, 'banner' => '/images/banner_7.jpg', 'thumbnail' => '/images/logo_160.png']);
     //卖家
     DB::table('sellers')->truncate();
     \Dajiayao\Model\Seller::create(['id' => 1, 'wx_user_id' => 1, 'mobile' => '15995420354', 'parent_id' => 0, 'realname' => '丫摇官方店主']);
     \Dajiayao\Model\Seller::create(['id' => 2, 'wx_user_id' => 2, 'mobile' => '13800138000', 'parent_id' => 0, 'realname' => '测试店主']);
     //微信user
     DB::table('wx_users')->truncate();
     \Dajiayao\Model\WxUser::create(['id' => 1, 'subscribe' => 1, 'openid' => 'oVtn9t9nmKQodGDQHLHfbHE_CDPI', 'nickname' => '小明', 'sex' => 1, 'city' => '苏州', 'country' => '中国', 'province' => '江苏', 'language' => 'zh_CN', 'role' => 2, 'headimgurl' => 'http://wx.qlogo.cn/mmopen/NWsF4EmJMsG8AeztibfdK5NWzAN6oX6PEwUOzeia9gzTvKW753aV0icuqTetiap4Tgf7q5sEdIaEstoa9hvvdlesuw/0']);
     \Dajiayao\Model\WxUser::create(['id' => 2, 'subscribe' => 1, 'openid' => 'oVtn9t9nmKQodGDQHLHfbHE_CDPI', 'nickname' => '小明2', 'sex' => 1, 'city' => '苏州', 'country' => '中国', 'province' => '江苏', 'language' => 'zh_CN', 'role' => 2, 'headimgurl' => 'http://wx.qlogo.cn/mmopen/NWsF4EmJMsG8AeztibfdK5NWzAN6oX6PEwUOzeia9gzTvKW753aV0icuqTetiap4Tgf7q5sEdIaEstoa9hvvdlesuw/0']);
     DB::table('items')->truncate();
     Item::create(['id' => 1, 'name' => '星巴克 星冰乐咖啡', 'title' => '星巴克 星冰乐咖啡', 'code' => '1234', 'barcode' => '678952135', 'type_id' => 1, 'supplier_id' => 1, 'spec' => '摩卡味 281ml', 'weight' => 281, 'volume' => 281, 'price' => 18, 'market_price' => 28, 'stock' => 10000, 'shelf_status' => 1, 'sale_status' => 1, 'comment' => '真便宜啊', 'postage_type' => 2]);
     Item::create(['id' => 2, 'name' => '星巴克 星冰乐咖啡', 'title' => '星巴克 星冰乐 香草味 咖啡饮料 281ml*6美国进口', 'code' => '1235', 'barcode' => '678952185', 'type_id' => 1, 'supplier_id' => 1, 'spec' => '摩卡味 281ml * 6', 'weight' => 1686, 'volume' => 1686, 'price' => 108, 'market_price' => 168, 'stock' => 10000, 'shelf_status' => 1, 'sale_status' => 1, 'comment' => '真的很便宜啊', 'postage_type' => 2]);
     Item::create(['id' => 3, 'name' => '星巴克 星冰乐咖啡', 'title' => '星巴克 星冰乐 摩卡 咖啡饮料 281ml*6美国进口', 'code' => '1236', 'barcode' => '678952165', 'type_id' => 1, 'supplier_id' => 1, 'spec' => '摩卡味 281ml * 6', 'weight' => 1686, 'volume' => 1686, 'price' => 108, 'market_price' => 168, 'stock' => 10000, 'shelf_status' => 1, 'sale_status' => 1, 'comment' => '买买买啊', 'postage_type' => 2]);
     DB::table('shop_items')->truncate();
     \Dajiayao\Model\ShopItem::create(["shop_id" => 1, "item_id" => 1, "stock" => 1000, "sort" => 1, "is_single" => 1]);
     \Dajiayao\Model\ShopItem::create(["shop_id" => 1, "item_id" => 2, "stock" => 1000, "sort" => 1, "is_single" => 1]);
     \Dajiayao\Model\ShopItem::create(["shop_id" => 1, "item_id" => 3, "stock" => 1000, "sort" => 1, "is_single" => 1]);
     DB::table('images')->truncate();
     \Dajiayao\Model\Image::create(['url' => '/images/product.jpg', 'name' => '星巴克', 'type' => 1]);
     DB::table('item_images')->truncate();
     \Dajiayao\Model\ItemImage::create(['item_id' => 1, 'image_id' => 1]);
     \Dajiayao\Model\ItemImage::create(['item_id' => 2, 'image_id' => 1]);
     \Dajiayao\Model\ItemImage::create(['item_id' => 3, 'image_id' => 1]);
     DB::table('item_type')->truncate();
     ItemType::create(['id' => 1, 'name' => '饮料', 'sort' => 1]);
     ItemType::create(['id' => 2, 'name' => '酒类', 'sort' => 2]);
     ItemType::create(['id' => 3, 'name' => '坚果', 'sort' => 3]);
     DB::table('expresses')->truncate();
     \Dajiayao\Model\Express::create(['name' => '圆通', 'code' => 'yuantong', 'website' => 'http://www.yto.net.cn', 'phone' => '95554']);
     \Dajiayao\Model\Express::create(['name' => '申通', 'code' => 'shentong', 'website' => 'http://www.sto.cn', 'phone' => '95543']);
     \Dajiayao\Model\Express::create(['name' => '韵达', 'code' => 'yunda', 'website' => 'http://www.yundaex.com', 'phone' => '400-821-6789']);
     \Dajiayao\Model\Express::create(['name' => '顺丰', 'code' => 'shunfeng', 'website' => 'http://www.sf-express.com', 'phone' => '95338']);
     DB::table('settings')->truncate();
     \Dajiayao\Model\Setting::create(['key' => 'commissions:rate', 'name' => '佣金比例', 'value' => '0.1', 'description' => '佣金 = 实际成交价 x 佣金比例', 'parent_id' => 0]);
     \Dajiayao\Model\Setting::create(['key' => 'order:payment:duration', 'name' => '订单最晚支付时间', 'value' => '1', 'parent_id' => 0]);
     \Dajiayao\Model\Setting::create(['key' => 'order:auto:receive:duration', 'name' => '发货后自动收货时间', 'value' => '36', 'parent_id' => 0]);
     \Dajiayao\Model\Setting::create(['key' => 'order:postage', 'name' => '统一邮费', 'value' => '10', 'parent_id' => 0]);
     DB::table('buyers')->truncate();
     \Dajiayao\Model\Buyer::create(['id' => 2, 'wx_user_id' => 2, 'mobile' => '18600186000', 'subscribe_status' => 1]);
     DB::table('buyer_addresses')->truncate();
     \Dajiayao\Model\BuyerAddress::create(['buyer_id' => 2, 'address_id' => 320507, 'address' => '相城区元和街道', 'postcode' => 215000, 'receiver' => 'zzq', 'mobile' => 159987548, 'default' => 1]);
 }
Example #2
0
 public function add()
 {
     $input = \Input::only('username', 'email', 'password', 'role');
     $username = $input['username'];
     $email = $input['email'];
     $role = $input['role'];
     if ($role != User::ROLE_COMMON_USER and $role != User::ROLE_ADMIN or $username == null or $email == null or !filter_var($email, FILTER_VALIDATE_EMAIL)) {
         return redirect()->back()->with('error_tips', '提交的数据不正确')->withInput();
     }
     if (User::isUserNameExist($username)) {
         return redirect()->back()->with('error_tips', '用户名已经存在')->withInput();
     }
     $password = $input['password'];
     $user = new User();
     $user->username = $username;
     $user->email = $email;
     $user->password = \Hash::make($password);
     $user->role = $role;
     $user->status = User::STATUS_NORMAL;
     $user->save();
     return redirect()->route('users')->with("success_tips", "保存成功!");
 }
Example #3
0
 public function getUserById($id)
 {
     return User::getById($id);
 }
Example #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call('UserTableSeeder');
     DB::table('users')->truncate();
     User::create(['username' => 'admin', 'email' => '*****@*****.**', 'password' => \Hash::make('11431143'), 'role' => User::ROLE_ADMIN, 'status' => User::STATUS_NORMAL]);
     User::create(['username' => 'yayao001', 'email' => '*****@*****.**', 'password' => \Hash::make('yayao001'), 'role' => User::ROLE_COMMON_USER, 'status' => User::STATUS_NORMAL]);
     DB::table('manufacturers')->truncate();
     Manufacturer::create(['name' => '佰睿科技', 'website' => 'http://www.bytereal.com', 'address' => '深圳市南山区高新南六道航盛科技大厦', 'email' => '*****@*****.**', 'phone' => '400-8899-181']);
     Manufacturer::create(['name' => '微肯科技', 'website' => 'http://www.wizarcan.com', 'address' => '上海市黄浦区西藏南路760号安基大厦706室', 'email' => '*****@*****.**', 'phone' => '021-63309703']);
     DB::table('device_models')->truncate();
     DeviceModel::create(['id' => 1, 'manufacturer_id' => 1, 'battery_lifetime' => 18, 'name' => 'BR', 'comment' => '佰睿']);
     DeviceModel::create(['id' => 2, 'manufacturer_id' => 2, 'battery_lifetime' => 18, 'name' => 'wizarcan', 'comment' => '微肯']);
     DB::table('apps')->truncate();
     App::create(['app_id' => 'yyfa7b475d22b0ef1d', 'app_secret' => 'ec6a2a765bc197a273841cd41ed171a2 ', 'name' => '丫摇小店', 'type' => App::TYPE_WEIXIN, 'access_token' => '', 'expire_at' => '2030-05-01 00:00:00', 'comment' => '丫摇小店(消费者服务号)', 'user_id' => 2, 'status' => App::STATUS_NORMAL]);
     App::create(['app_id' => 'yy3a6b475fc2b19f2e', 'app_secret' => '3a76597a2784bc11edeccd416a2171a2', 'name' => '测试应用', 'type' => App::TYPE_WEIXIN, 'access_token' => '', 'expire_at' => '2030-05-01 00:00:00', 'comment' => '测试应用', 'user_id' => 2, 'status' => App::STATUS_NORMAL]);
     DB::table('wx_mp')->truncate();
     WeixinMp::create(['appid' => 'wxfb42b0ea75d27f1d', 'appsecret' => 'a62a7197273e81cd4a1d14715bca2ec6', 'name' => '丫摇小店', 'mp_id' => 'gh_dd4f2e417685', 'comment' => '丫摇小店(消费者服务号)', 'app_id' => 1]);
     WeixinMp::create(['appid' => 'wxbc879a670cb32971', 'appsecret' => '20b517a9882cecc620e20175f8943ef0', 'name' => '测试号', 'mp_id' => 'gh_dxxxxxxxx', 'comment' => '测试', 'app_id' => 2]);
     DB::table('devices')->truncate();
     //        \Dajiayao\Model\Device::create([
     //            "id"=>1,
     //            "model_id"=>1,
     //            "manufacturer_sn"=>11111,
     //            "sn"=>2015121212,
     //            "wx_device_id"=>1,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10001,
     //            "minor"=>44330,
     //            "password"=>123456,
     //            "comment"=>'comment',
     //            "status"=>1
     //        ]);
     //
     //        \Dajiayao\Model\Device::create([
     //            "id"=>2,
     //            "model_id"=>1,
     //            "manufacturer_sn"=>22222,
     //            "sn"=>2015131313,
     //            "wx_device_id"=>1,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10001,
     //            "minor"=>44330,
     //            "password"=>123456,
     //            "comment"=>'comment',
     //            "status"=>1
     //        ]);
     //
     //        \Dajiayao\Model\Device::create([
     //            "id"=>3,
     //            "model_id"=>1,
     //            "manufacturer_sn"=>33333,
     //            "sn"=>2015141414,
     //            "wx_device_id"=>2,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10001,
     //            "minor"=>44331,
     //            "password"=>123456,
     //            "comment"=>'comment',
     //            "status"=>1
     //        ]);
     //
     //        \Dajiayao\Model\Device::create([
     //            "id"=>4,
     //            "model_id"=>1,
     //            "manufacturer_sn"=>44444,
     //            "sn"=>201515151515,
     //            "wx_device_id"=>3,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10001,
     //            "minor"=>44332,
     //            "password"=>123456,
     //            "comment"=>'comment',
     //            "status"=>1
     //        ]);
     DB::table('wx_devices')->truncate();
     //        \Dajiayao\Model\WeixinDevice::create([
     //            'id'=>1,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10001,
     //            "minor"=>44330,
     //            "device_id"=>657415,
     //            "wx_mp_id"=>1
     //        ]);
     //
     //
     //        \Dajiayao\Model\WeixinDevice::create([
     //            'id'=>2,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10001,
     //            "minor"=>44331,
     //            "device_id"=>657416,
     //            "wx_mp_id"=>1
     //        ]);
     //
     //        \Dajiayao\Model\WeixinDevice::create([
     //            'id'=>3,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10001,
     //            "minor"=>44332,
     //            "device_id"=>657417,
     //            "wx_mp_id"=>1
     //        ]);
     //
     //        \Dajiayao\Model\WeixinDevice::create([
     //            'id'=>4,
     //            "uuid"=>'FDA50693-A4E2-4FB1-AFCF-C6EB07647825',
     //            "major"=>10007,
     //            "minor"=>41549,
     //            "device_id"=>681062,
     //            "wx_mp_id"=>1,
     //            "apply_id"=>26858
     //        ]);
     DB::table('wx_pages')->truncate();
     //        \Dajiayao\Model\WeixinPage::create([
     //            "wx_mp_id"=>1,
     //            "page_id"=>81039,
     //            'title'=>'周边主标题',
     //            'description'=>'副标题',
     //            'icon_url'=>'http://shp.qpic.cn/wx_shake_bus/0/1431503979e9dd2797018cad79186e03e8c5aec8dc/120',
     //            'url'=>'http://www.baidu.com',
     //            'comment'=>'comment'
     //        ]);
     //
     //        DB::table('wx_mp')->truncate();
     //        \Dajiayao\Model\WeixinMp::create([
     //            "id"=>1,
     //            "appid"=>'wxbc879a670cb32971',
     //            'appsecret'=>'20b517a9882cecc620e20175f8943ef0',
     //            'name'=>'大家摇',
     //            'mp_id'=>'原始id',
     //            'app_id'=>1
     //        ]);
 }
Example #5
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }