人人商城

phoneapp.table.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. defined('IN_IA') or exit('Access Denied');
  3. load()->table('account');
  4. class PhoneappTable extends AccountTable {
  5. public function createPhoneApp($data) {
  6. $account = array(
  7. 'name' => $data['name'],
  8. 'description' => $data['description'],
  9. 'title_initial' => get_first_pinyin($data['name']),
  10. 'groupid' => 0,
  11. );
  12. if (!pdo_insert('uni_account', $account)) {
  13. return false;
  14. }
  15. $uniacid = pdo_insertid();
  16. if (empty($uniacid)) {
  17. return false;
  18. }
  19. $accountdata = array('uniacid' => $uniacid, 'type' => ACCOUNT_TYPE_PHONEAPP_NORMAL, 'hash' => random(8));
  20. pdo_insert('account', $accountdata);
  21. $acid = pdo_insertid();
  22. pdo_update('uni_account', array('default_acid' => $acid), array('uniacid' => $uniacid));
  23. pdo_insert('account_phoneapp', array('uniacid' => $uniacid, 'acid' => $acid, 'name' => $data['name']));
  24. pdo_insert('phoneapp_versions', array('uniacid' => $uniacid, 'version' => $data['version'], 'description' => $data['description'], 'modules' => $data['modules'], 'createtime' => TIMESTAMP));
  25. return true;
  26. }
  27. public function phoneappAccountInfo() {
  28. return $this->query->from('account_phoneapp')->get();
  29. }
  30. }