人人商城

xzapp.mod.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. defined('IN_IA') or exit('Access Denied');
  3. function xzapp_create($attr, $uid) {
  4. $name = $attr['name'];
  5. $description = $attr['description'];
  6. $data = array(
  7. 'name' => $name,
  8. 'description' => $description,
  9. 'title_initial' => get_first_pinyin($name),
  10. 'groupid' => 0,
  11. );
  12. if (!pdo_insert('uni_account', $data)) {
  13. return false;
  14. }
  15. $uniacid = pdo_insertid();
  16. if(!$uniacid) {
  17. return false;
  18. }
  19. $accountdata = array('uniacid' => $uniacid, 'type' => ACCOUNT_TYPE_XZAPP_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_xzapp', array('uniacid'=>$uniacid, 'acid'=>$acid, 'name'=>$name));
  24. $unisettings['creditnames'] = array('credit1' => array('title' => '积分', 'enabled' => 1), 'credit2' => array('title' => '余额', 'enabled' => 1));
  25. $unisettings['creditnames'] = iserializer($unisettings['creditnames']);
  26. $unisettings['creditbehaviors'] = array('activity' => 'credit1', 'currency' => 'credit2');
  27. $unisettings['creditbehaviors'] = iserializer($unisettings['creditbehaviors']);
  28. $unisettings['uniacid'] = $uniacid;
  29. pdo_insert('uni_settings', $unisettings);
  30. return $uniacid;
  31. }